Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -231,8 +231,7 @@ def ragent_reasoning(prompt: str, history: list[dict], max_tokens: int = 1024, t
|
|
231 |
# Gradio UI configuration
|
232 |
|
233 |
DESCRIPTION = """
|
234 |
-
# Agent Dino 🌠
|
235 |
-
"""
|
236 |
|
237 |
css = '''
|
238 |
h1 {
|
@@ -569,54 +568,42 @@ def generate(
|
|
569 |
output_file = asyncio.run(text_to_speech(final_response, voice))
|
570 |
yield gr.Audio(output_file, autoplay=True)
|
571 |
|
572 |
-
# Gradio Chat Interface Setup and Launch
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
["@image Chocolate dripping from a donut against a yellow background, in the style of brocore, hyper-realistic"],
|
602 |
-
["@rAgent Explain how a binary search algorithm works."],
|
603 |
-
["@web latest breakthroughs in renewable energy"],
|
604 |
-
],
|
605 |
-
cache_examples=False,
|
606 |
-
type="messages",
|
607 |
-
description=DESCRIPTION,
|
608 |
-
fill_height=True,
|
609 |
-
textbox=gr.MultimodalTextbox(label="Query Input", file_types=["image"], file_count="multiple"),
|
610 |
-
stop_btn="Stop Generation",
|
611 |
-
multimodal=True,
|
612 |
-
)
|
613 |
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
|
618 |
-
|
619 |
-
|
620 |
|
621 |
if __name__ == "__main__":
|
622 |
demo.queue(max_size=20).launch(share=True)
|
|
|
231 |
# Gradio UI configuration
|
232 |
|
233 |
DESCRIPTION = """
|
234 |
+
# Agent Dino 🌠 """
|
|
|
235 |
|
236 |
css = '''
|
237 |
h1 {
|
|
|
568 |
output_file = asyncio.run(text_to_speech(final_response, voice))
|
569 |
yield gr.Audio(output_file, autoplay=True)
|
570 |
|
571 |
+
# Gradio Chat Interface Setup and Launch
|
572 |
+
|
573 |
+
demo = gr.ChatInterface(
|
574 |
+
fn=generate,
|
575 |
+
additional_inputs=[
|
576 |
+
gr.Slider(label="Max new tokens", minimum=1, maximum=MAX_MAX_NEW_TOKENS, step=1, value=DEFAULT_MAX_NEW_TOKENS),
|
577 |
+
gr.Slider(label="Temperature", minimum=0.1, maximum=4.0, step=0.1, value=0.6),
|
578 |
+
gr.Slider(label="Top-p (nucleus sampling)", minimum=0.05, maximum=1.0, step=0.05, value=0.9),
|
579 |
+
gr.Slider(label="Top-k", minimum=1, maximum=1000, step=1, value=50),
|
580 |
+
gr.Slider(label="Repetition penalty", minimum=1.0, maximum=2.0, step=0.05, value=1.2),
|
581 |
+
],
|
582 |
+
examples=[
|
583 |
+
["@tts2 What causes rainbows to form?"],
|
584 |
+
["@3d A birthday cupcake with cherry"],
|
585 |
+
[{"text": "summarize the letter", "files": ["examples/1.png"]}],
|
586 |
+
["@image Chocolate dripping from a donut against a yellow background, in the style of brocore, hyper-realistic"],
|
587 |
+
["@rAgent Explain how a binary search algorithm works."],
|
588 |
+
["@web latest breakthroughs in renewable energy"],
|
589 |
+
|
590 |
+
],
|
591 |
+
cache_examples=False,
|
592 |
+
type="messages",
|
593 |
+
description=DESCRIPTION,
|
594 |
+
css=css,
|
595 |
+
fill_height=True,
|
596 |
+
textbox=gr.MultimodalTextbox(label="Query Input", file_types=["image"], file_count="multiple"),
|
597 |
+
stop_btn="Stop Generation",
|
598 |
+
multimodal=True,
|
599 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
600 |
|
601 |
+
# Ensure the static folder exists
|
602 |
+
if not os.path.exists("static"):
|
603 |
+
os.makedirs("static")
|
604 |
|
605 |
+
from fastapi.staticfiles import StaticFiles
|
606 |
+
demo.app.mount("/static", StaticFiles(directory="static"), name="static")
|
607 |
|
608 |
if __name__ == "__main__":
|
609 |
demo.queue(max_size=20).launch(share=True)
|