Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -231,7 +231,8 @@ 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 |
css = '''
|
| 237 |
h1 {
|
|
@@ -568,20 +569,22 @@ def generate(
|
|
| 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 |
with gr.Blocks(css=css) as demo:
|
| 574 |
with gr.Sidebar(label="Usage", open=True):
|
| 575 |
gr.Markdown(
|
| 576 |
-
"
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
|
|
|
|
|
|
|
|
|
| 583 |
)
|
| 584 |
-
|
| 585 |
chat_interface = gr.ChatInterface(
|
| 586 |
fn=generate,
|
| 587 |
additional_inputs=[
|
|
@@ -602,14 +605,16 @@ with gr.Blocks(css=css) as demo:
|
|
| 602 |
cache_examples=False,
|
| 603 |
type="messages",
|
| 604 |
description=DESCRIPTION,
|
| 605 |
-
css=css,
|
| 606 |
fill_height=True,
|
| 607 |
textbox=gr.MultimodalTextbox(label="Query Input", file_types=["image"], file_count="multiple"),
|
| 608 |
stop_btn="Stop Generation",
|
| 609 |
multimodal=True,
|
| 610 |
)
|
| 611 |
|
| 612 |
-
# Ensure the static folder
|
|
|
|
|
|
|
|
|
|
| 613 |
from fastapi.staticfiles import StaticFiles
|
| 614 |
demo.app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 615 |
|
|
|
|
| 231 |
# Gradio UI configuration
|
| 232 |
|
| 233 |
DESCRIPTION = """
|
| 234 |
+
# Agent Dino 🌠
|
| 235 |
+
"""
|
| 236 |
|
| 237 |
css = '''
|
| 238 |
h1 {
|
|
|
|
| 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 with Sidebar
|
| 573 |
|
| 574 |
with gr.Blocks(css=css) as demo:
|
| 575 |
with gr.Sidebar(label="Usage", open=True):
|
| 576 |
gr.Markdown(
|
| 577 |
+
"""
|
| 578 |
+
### About Space
|
| 579 |
+
|
| 580 |
+
This chat interface supports multiple commands:
|
| 581 |
+
- `@tts1` or `@tts2`: Triggers text-to-speech.
|
| 582 |
+
- `@image`: Generates an image using Stable Diffusion XL.
|
| 583 |
+
- `@3d`: Generates a 3D model using the ShapE pipeline.
|
| 584 |
+
- `@web`: Performs a web search or visits a webpage.
|
| 585 |
+
- `@rAgent`: Initiates a reasoning chain using Llama mode OpenAI.
|
| 586 |
+
"""
|
| 587 |
)
|
|
|
|
| 588 |
chat_interface = gr.ChatInterface(
|
| 589 |
fn=generate,
|
| 590 |
additional_inputs=[
|
|
|
|
| 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 |
+
# Ensure the static folder exists
|
| 615 |
+
if not os.path.exists("static"):
|
| 616 |
+
os.makedirs("static")
|
| 617 |
+
|
| 618 |
from fastapi.staticfiles import StaticFiles
|
| 619 |
demo.app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 620 |
|