Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -569,13 +569,11 @@ def live_denoise(src, state_ids, steps, snap_every, seed, mode, temperature, exc
|
|
| 569 |
# ===============================================
|
| 570 |
# UI (single mode)
|
| 571 |
# ===============================================
|
| 572 |
-
with gr.Blocks(title="
|
| 573 |
gr.Markdown(
|
| 574 |
"""
|
| 575 |
-
#
|
| 576 |
-
|
| 577 |
-
- Update rule per step: **argmax** or **sample** (temperature + exclude current).
|
| 578 |
-
- Tools: Random init, **drag to select** in the text box → *Noise Selection*, manual indices, prepend/append noise, live denoise.
|
| 579 |
"""
|
| 580 |
)
|
| 581 |
|
|
@@ -585,7 +583,7 @@ with gr.Blocks(title="CNA — Interactive Denoising") as demo:
|
|
| 585 |
|
| 586 |
with gr.Row():
|
| 587 |
src = gr.Textbox(value=default_source, label="Weights (file / folder / HF repo id)")
|
| 588 |
-
seqlen = gr.Slider(10, 512, value=
|
| 589 |
seed = gr.Slider(0, 10000, value=0, step=1, label="Seed")
|
| 590 |
|
| 591 |
ids_state = gr.State(value=None)
|
|
@@ -597,16 +595,20 @@ with gr.Blocks(title="CNA — Interactive Denoising") as demo:
|
|
| 597 |
gr.Markdown("### Initialize & Denoise")
|
| 598 |
with gr.Row():
|
| 599 |
btn_random = gr.Button("Initialize Random")
|
| 600 |
-
steps = gr.Slider(1, 2000, value=
|
| 601 |
-
snap_every = gr.Slider(1, 100, value=
|
| 602 |
with gr.Row():
|
| 603 |
-
update_mode = gr.Radio(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 604 |
temperature = gr.Slider(minimum=0.0, maximum=5.0, value=1.0, step=0.05, label="Temperature (sampling)")
|
| 605 |
exclude_current = gr.Checkbox(value=True, label="Exclude current token when sampling")
|
| 606 |
with gr.Row():
|
| 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(
|
|
@@ -617,6 +619,7 @@ with gr.Blocks(title="CNA — Interactive Denoising") as demo:
|
|
| 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 ---
|
|
|
|
| 569 |
# ===============================================
|
| 570 |
# UI (single mode)
|
| 571 |
# ===============================================
|
| 572 |
+
with gr.Blocks(title="Self Organising Text Demo") as demo:
|
| 573 |
gr.Markdown(
|
| 574 |
"""
|
| 575 |
+
# Self Organising Text Demo
|
| 576 |
+
Watch text self organise using only local attention.
|
|
|
|
|
|
|
| 577 |
"""
|
| 578 |
)
|
| 579 |
|
|
|
|
| 583 |
|
| 584 |
with gr.Row():
|
| 585 |
src = gr.Textbox(value=default_source, label="Weights (file / folder / HF repo id)")
|
| 586 |
+
seqlen = gr.Slider(10, 512, value=50, step=1, label="Sequence length (S)")
|
| 587 |
seed = gr.Slider(0, 10000, value=0, step=1, label="Seed")
|
| 588 |
|
| 589 |
ids_state = gr.State(value=None)
|
|
|
|
| 595 |
gr.Markdown("### Initialize & Denoise")
|
| 596 |
with gr.Row():
|
| 597 |
btn_random = gr.Button("Initialize Random")
|
| 598 |
+
steps = gr.Slider(1, 2000, value=100, step=1, label="Denoise steps (N)") # default 100
|
| 599 |
+
snap_every = gr.Slider(1, 100, value=1, step=1, label="Update every K steps") # default 1
|
| 600 |
with gr.Row():
|
| 601 |
+
update_mode = gr.Radio(
|
| 602 |
+
choices=["argmax", "sample"],
|
| 603 |
+
value="sample", # default to sampling
|
| 604 |
+
label="Update rule"
|
| 605 |
+
)
|
| 606 |
temperature = gr.Slider(minimum=0.0, maximum=5.0, value=1.0, step=0.05, label="Temperature (sampling)")
|
| 607 |
exclude_current = gr.Checkbox(value=True, label="Exclude current token when sampling")
|
| 608 |
with gr.Row():
|
| 609 |
btn_step_once = gr.Button("Step Once")
|
| 610 |
btn_live = gr.Button("Denoise Live (streaming)")
|
| 611 |
+
|
| 612 |
gr.Markdown("### Noise by Indices")
|
| 613 |
with gr.Row():
|
| 614 |
indices_csv = gr.Textbox(
|
|
|
|
| 619 |
add_left = gr.Number(value=0, precision=0, label="Noise tokens to add at START")
|
| 620 |
add_right = gr.Number(value=0, precision=0, label="Noise tokens to add at END")
|
| 621 |
btn_apply_noise = gr.Button("Apply Noise")
|
| 622 |
+
|
| 623 |
|
| 624 |
|
| 625 |
# --- Wiring ---
|