Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -434,26 +434,23 @@ css = '''
|
|
| 434 |
button{min-height: 60px}
|
| 435 |
'''
|
| 436 |
def create_chatbot_demo():
|
| 437 |
-
with gr.Blocks(css=css
|
| 438 |
gr.Markdown("# Dream 7B - Diffusion Language Model Demo")
|
| 439 |
gr.Markdown(
|
| 440 |
"[[Model Card](https://huggingface.co/Dream-org/Dream-v0-Instruct-7B)] "
|
| 441 |
"[[Blog](https://hkunlp.github.io/blog/2025/dream/)]"
|
| 442 |
)
|
| 443 |
|
| 444 |
-
# Use Chatbot directly for state, matching the expected format
|
| 445 |
-
chatbot_ui = gr.Chatbot(
|
| 446 |
-
label="Conversation",
|
| 447 |
-
height=500,
|
| 448 |
-
show_copy_button=True,
|
| 449 |
-
bubble_full_width=False,
|
| 450 |
-
value=[], # Initialize empty
|
| 451 |
-
type="messages" # Crucial: Use the messages format
|
| 452 |
-
)
|
| 453 |
-
|
| 454 |
with gr.Row():
|
| 455 |
with gr.Column(scale=3):
|
| 456 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 457 |
with gr.Group():
|
| 458 |
with gr.Row():
|
| 459 |
user_input = gr.Textbox(
|
|
@@ -468,11 +465,11 @@ def create_chatbot_demo():
|
|
| 468 |
)
|
| 469 |
with gr.Column(scale=2):
|
| 470 |
output_vis = gr.HighlightedText(
|
| 471 |
-
label="Denoising Process Visualization", combine_adjacent=
|
| 472 |
-
show_legend=
|
| 473 |
)
|
| 474 |
response_text_display = gr.Textbox(
|
| 475 |
-
label="Current/Final Response", interactive=False, lines=5
|
| 476 |
)
|
| 477 |
|
| 478 |
# [Keep Accordion with Generation Settings the same]
|
|
@@ -489,7 +486,7 @@ def create_chatbot_demo():
|
|
| 489 |
with gr.Row():
|
| 490 |
remasking_strategy = gr.Radio(choices=['origin', 'maskgit_plus', 'topk_margin', 'entropy'], value='entropy', label="Remasking Strategy")
|
| 491 |
with gr.Row():
|
| 492 |
-
visualization_delay = gr.Slider(minimum=0.0, maximum=0.5, value=0.
|
| 493 |
|
| 494 |
clear_btn = gr.Button("Clear Conversation")
|
| 495 |
|
|
|
|
| 434 |
button{min-height: 60px}
|
| 435 |
'''
|
| 436 |
def create_chatbot_demo():
|
| 437 |
+
with gr.Blocks(css=css) as demo:
|
| 438 |
gr.Markdown("# Dream 7B - Diffusion Language Model Demo")
|
| 439 |
gr.Markdown(
|
| 440 |
"[[Model Card](https://huggingface.co/Dream-org/Dream-v0-Instruct-7B)] "
|
| 441 |
"[[Blog](https://hkunlp.github.io/blog/2025/dream/)]"
|
| 442 |
)
|
| 443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 444 |
with gr.Row():
|
| 445 |
with gr.Column(scale=3):
|
| 446 |
+
chatbot_ui = gr.Chatbot(
|
| 447 |
+
label="Conversation",
|
| 448 |
+
height=500,
|
| 449 |
+
show_copy_button=True,
|
| 450 |
+
bubble_full_width=False,
|
| 451 |
+
value=[], # Initialize empty
|
| 452 |
+
type="messages" # Crucial: Use the messages format
|
| 453 |
+
)
|
| 454 |
with gr.Group():
|
| 455 |
with gr.Row():
|
| 456 |
user_input = gr.Textbox(
|
|
|
|
| 465 |
)
|
| 466 |
with gr.Column(scale=2):
|
| 467 |
output_vis = gr.HighlightedText(
|
| 468 |
+
label="Denoising Process Visualization", combine_adjacent=False,
|
| 469 |
+
show_legend=True, interactive=False
|
| 470 |
)
|
| 471 |
response_text_display = gr.Textbox(
|
| 472 |
+
label="Current/Final Response", interactive=False, lines=5, visible=False
|
| 473 |
)
|
| 474 |
|
| 475 |
# [Keep Accordion with Generation Settings the same]
|
|
|
|
| 486 |
with gr.Row():
|
| 487 |
remasking_strategy = gr.Radio(choices=['origin', 'maskgit_plus', 'topk_margin', 'entropy'], value='entropy', label="Remasking Strategy")
|
| 488 |
with gr.Row():
|
| 489 |
+
visualization_delay = gr.Slider(minimum=0.0, maximum=0.5, value=0.0, step=0.01, label="Visualization Delay (s)")
|
| 490 |
|
| 491 |
clear_btn = gr.Button("Clear Conversation")
|
| 492 |
|