Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -607,31 +607,21 @@ with gr.Blocks(title="CNA — Interactive Denoising") as demo:
|
|
| 607 |
btn_step_once = gr.Button("Step Once")
|
| 608 |
btn_live = gr.Button("Denoise Live (streaming)")
|
| 609 |
|
| 610 |
-
gr.Markdown("### Noise
|
| 611 |
with gr.Row():
|
| 612 |
-
indices_csv = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
| 613 |
with gr.Row():
|
| 614 |
add_left = gr.Number(value=0, precision=0, label="Noise tokens to add at START")
|
| 615 |
add_right = gr.Number(value=0, precision=0, label="Noise tokens to add at END")
|
| 616 |
-
|
| 617 |
-
|
| 618 |
|
| 619 |
# --- Wiring ---
|
| 620 |
btn_random.click(init_random, [src, seqlen, seed], [ids_state, current_text, status])
|
| 621 |
|
| 622 |
-
# Select in text → auto-compute token indices into indices_csv
|
| 623 |
-
current_text.select(
|
| 624 |
-
capture_selection,
|
| 625 |
-
[current_text, seqlen, ids_state],
|
| 626 |
-
[indices_csv, status]
|
| 627 |
-
)
|
| 628 |
-
|
| 629 |
-
# “Noise Selection” just applies whatever is in indices_csv
|
| 630 |
-
btn_noise_selection.click(
|
| 631 |
-
noise_selection,
|
| 632 |
-
[src, ids_state, seqlen, indices_csv, seed],
|
| 633 |
-
[ids_state, current_text, status]
|
| 634 |
-
)
|
| 635 |
|
| 636 |
|
| 637 |
# Manual indices + prepend/append noise
|
|
|
|
| 607 |
btn_step_once = gr.Button("Step Once")
|
| 608 |
btn_live = gr.Button("Denoise Live (streaming)")
|
| 609 |
|
| 610 |
+
gr.Markdown("### Noise by Indices")
|
| 611 |
with gr.Row():
|
| 612 |
+
indices_csv = gr.Textbox(
|
| 613 |
+
label="Positions to noise (enter like: 0, 5, 10-20)",
|
| 614 |
+
placeholder="e.g., 0, 5, 10-20"
|
| 615 |
+
)
|
| 616 |
with gr.Row():
|
| 617 |
add_left = gr.Number(value=0, precision=0, label="Noise tokens to add at START")
|
| 618 |
add_right = gr.Number(value=0, precision=0, label="Noise tokens to add at END")
|
| 619 |
+
btn_apply_noise = gr.Button("Apply Noise")
|
| 620 |
+
|
| 621 |
|
| 622 |
# --- Wiring ---
|
| 623 |
btn_random.click(init_random, [src, seqlen, seed], [ids_state, current_text, status])
|
| 624 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 625 |
|
| 626 |
|
| 627 |
# Manual indices + prepend/append noise
|