Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from utils.run_pipeline_and_save import run_pipeline_and_save
|
3 |
+
from utils.zip_output import zip_output
|
4 |
+
|
5 |
+
def run_agents(prompt):
|
6 |
+
if not prompt.strip():
|
7 |
+
return "Please enter a prompt.", None, None
|
8 |
+
chat_log, final_output = run_pipeline_and_save(prompt)
|
9 |
+
log_str = "\n\n".join([f"### {list(item.keys())[0]}\n{list(item.values())[0]}" for item in chat_log])
|
10 |
+
zip_path = zip_output()
|
11 |
+
return log_str, zip_path, "output/agent_log.json"
|
12 |
+
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=run_agents,
|
15 |
+
inputs=gr.Textbox(lines=10, label="Enter your product idea prompt"),
|
16 |
+
outputs=[
|
17 |
+
gr.Textbox(label="Agent Conversation Log", lines=20),
|
18 |
+
gr.File(label="Download UI Files (ZIP)"),
|
19 |
+
gr.File(label="Download Agent Log (JSON)"),
|
20 |
+
],
|
21 |
+
title="Multi-Agent UI Generator",
|
22 |
+
)
|
23 |
+
|
24 |
+
if __name__ == "__main__":
|
25 |
+
iface.launch()
|