Prof-Hunter's picture
Update app.py
249243b verified
import gradio as gr
from orchestrator import run_workflow
def run_system(problem, order, bias, override, human_text):
results = run_workflow(problem, order, bias)
final = results.get("Final", "")
if override and human_text.strip():
final = f"πŸ§‘β€βš–οΈ HUMAN OVERRIDE\n\n{human_text}"
return (
results.get("Market", ""),
results.get("Finance", ""),
results.get("Risk", ""),
results.get("Ethics", ""),
final
)
# Material-style theme
theme = gr.themes.Soft(
primary_hue="blue",
secondary_hue="cyan",
radius_size="lg",
font=["Inter", "sans-serif"]
)
with gr.Blocks(theme=theme) as demo:
gr.Markdown(
"""
# 🧠 AI Strategy Lab
### Multi-Agent Decision System
Demonstrates:
β€’ Agent workflows
β€’ Order effects
β€’ Bias
β€’ Human-in-the-loop
"""
)
with gr.Row():
with gr.Column(scale=2):
problem = gr.Textbox(
label="πŸ“Œ Problem Statement",
lines=4,
placeholder="Should we launch Product X in Market Y?"
)
order = gr.Textbox(
label="πŸ” Agent Order (comma-separated)",
value="Market, Finance, Risk, Ethics",
info="Example: Risk, Finance, Market, Ethics"
)
bias = gr.Checkbox(
label="Inject Market Bias"
)
override = gr.Checkbox(
label="Enable Human Override"
)
human_text = gr.Textbox(
label="Human Decision",
lines=3
)
run_btn = gr.Button(
"πŸš€ Run Analysis",
variant="primary"
)
with gr.Column(scale=3):
with gr.Tab("πŸ“Š Market"):
market_out = gr.Textbox(lines=10)
with gr.Tab("πŸ’° Finance"):
finance_out = gr.Textbox(lines=10)
with gr.Tab("⚠️ Risk"):
risk_out = gr.Textbox(lines=10)
with gr.Tab("🌱 Ethics"):
ethics_out = gr.Textbox(lines=10)
with gr.Tab("βœ… Final Decision"):
final_out = gr.Textbox(lines=12)
run_btn.click(
run_system,
inputs=[
problem,
order,
bias,
override,
human_text
],
outputs=[
market_out,
finance_out,
risk_out,
ethics_out,
final_out
]
)
demo.launch()