Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,28 +1,31 @@
|
|
1 |
import gradio as gr
|
2 |
-
from utils.
|
3 |
from utils.zip_output import zip_output
|
4 |
|
5 |
-
|
6 |
-
os.environ["PYTORCH_SDP_ATTENTION"] = "math"
|
7 |
-
|
8 |
-
def run_agents(prompt):
|
9 |
-
if not prompt.strip():
|
10 |
-
return "Please enter a prompt.", None, None
|
11 |
chat_log, final_output = run_pipeline_and_save(prompt)
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
gr.File(label="Download UI Files (ZIP)"),
|
22 |
-
gr.File(label="Download Agent Log (JSON)"),
|
23 |
-
],
|
24 |
-
title="Multi-Agent UI Generator",
|
25 |
-
)
|
26 |
|
27 |
-
|
28 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from utils.langgraph_pipeline import run_pipeline_and_save
|
3 |
from utils.zip_output import zip_output
|
4 |
|
5 |
+
def handle_run(prompt):
|
|
|
|
|
|
|
|
|
|
|
6 |
chat_log, final_output = run_pipeline_and_save(prompt)
|
7 |
+
return (
|
8 |
+
[(f"{agent}", msg) for step in chat_log for agent, msg in step.items()],
|
9 |
+
"output/index.html",
|
10 |
+
"output/agent_log.json",
|
11 |
+
zip_output()
|
12 |
+
)
|
13 |
+
|
14 |
+
with gr.Blocks() as demo:
|
15 |
+
gr.Markdown("# 🔗 Multi-Agent Collaboration with LangGraph")
|
16 |
+
|
17 |
+
prompt_input = gr.Textbox(label="Enter your prompt", lines=4, placeholder="Describe your product idea...")
|
18 |
+
submit_btn = gr.Button("Run Agents")
|
19 |
+
|
20 |
+
chatbox = gr.Chatbot(label="Agent Conversation Log")
|
21 |
+
html_out = gr.File(label="index.html")
|
22 |
+
log_out = gr.File(label="Agent Log")
|
23 |
+
zip_out = gr.File(label="ZIP Output")
|
24 |
|
25 |
+
submit_btn.click(
|
26 |
+
fn=handle_run,
|
27 |
+
inputs=prompt_input,
|
28 |
+
outputs=[chatbox, html_out, log_out, zip_out]
|
29 |
+
)
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
demo.launch()
|
|