Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from orchestrator import run_workflow
|
| 3 |
+
|
| 4 |
+
def launch_app(problem, agent_order, bias_mode, human_override, human_text):
|
| 5 |
+
outputs = run_workflow(problem, agent_order, bias_mode)
|
| 6 |
+
|
| 7 |
+
final = outputs["Final Recommendation"]
|
| 8 |
+
|
| 9 |
+
if human_override:
|
| 10 |
+
final = f"HUMAN OVERRIDE APPLIED:\n\n{human_text}"
|
| 11 |
+
|
| 12 |
+
return (
|
| 13 |
+
outputs.get("Market", ""),
|
| 14 |
+
outputs.get("Finance", ""),
|
| 15 |
+
outputs.get("Risk", ""),
|
| 16 |
+
outputs.get("Ethics", ""),
|
| 17 |
+
final
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
with gr.Blocks(title="AI Strategy Lab") as demo:
|
| 21 |
+
gr.Markdown("# 🧠 AI Strategy Lab")
|
| 22 |
+
gr.Markdown("**Multi-Agent AI | Workflow Order | Human-in-the-Loop**")
|
| 23 |
+
|
| 24 |
+
problem = gr.Textbox(label="Problem Statement", lines=4)
|
| 25 |
+
|
| 26 |
+
agent_order = gr.CheckboxGroup(
|
| 27 |
+
["Market", "Finance", "Risk", "Ethics"],
|
| 28 |
+
value=["Market", "Finance", "Risk", "Ethics"],
|
| 29 |
+
label="Agent Execution Order (ORDER MATTERS!)"
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
bias_mode = gr.Checkbox(label="Inject Market Optimism Bias")
|
| 33 |
+
human_override = gr.Checkbox(label="Enable Human Override")
|
| 34 |
+
human_text = gr.Textbox(label="Human Decision", lines=3)
|
| 35 |
+
|
| 36 |
+
run = gr.Button("🚀 Run AI Strategy Lab")
|
| 37 |
+
|
| 38 |
+
with gr.Tab("Market Agent"):
|
| 39 |
+
market_out = gr.Textbox(lines=10)
|
| 40 |
+
with gr.Tab("Finance Agent"):
|
| 41 |
+
finance_out = gr.Textbox(lines=10)
|
| 42 |
+
with gr.Tab("Risk Agent"):
|
| 43 |
+
risk_out = gr.Textbox(lines=10)
|
| 44 |
+
with gr.Tab("Ethics Agent"):
|
| 45 |
+
ethics_out = gr.Textbox(lines=10)
|
| 46 |
+
with gr.Tab("Final Decision"):
|
| 47 |
+
final_out = gr.Textbox(lines=12)
|
| 48 |
+
|
| 49 |
+
run.click(
|
| 50 |
+
launch_app,
|
| 51 |
+
inputs=[problem, agent_order, bias_mode, human_override, human_text],
|
| 52 |
+
outputs=[market_out, finance_out, risk_out, ethics_out, final_out]
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
demo.launch()
|