| import gradio as gr | |
| def gaia_agent(question): | |
| q = question.lower().strip() | |
| if "capital of japan" in q: | |
| return "Tokyo" | |
| if "capital of france" in q: | |
| return "Paris" | |
| if "2 + 2" in q or "2+2" in q: | |
| return "4" | |
| return "" | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# GAIA Agent") | |
| q = gr.Textbox(label="GAIA Question", lines=6) | |
| a = gr.Textbox(label="Agent Answer") | |
| btn = gr.Button("Answer") | |
| btn.click(gaia_agent, inputs=q, outputs=a) | |
| demo.launch() |