Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -56,93 +56,97 @@ gr.close_all()
|
|
56 |
|
57 |
with gr.Blocks() as grady:
|
58 |
gr.Markdown("## Grady - General AI Assistant")
|
59 |
-
gr.Markdown(os.environ.get("DESCRIPTION"))
|
60 |
|
61 |
-
with gr.
|
62 |
-
|
63 |
-
with gr.Row():
|
64 |
-
question = gr.Textbox(
|
65 |
-
label="Question *",
|
66 |
-
placeholder="In the 2025 Gradio Agents & MCP Hackathon, what percentage of participants submitted a solution during the last 24 hours?",
|
67 |
-
interactive=True
|
68 |
-
)
|
69 |
-
with gr.Row():
|
70 |
-
level = gr.Radio(
|
71 |
-
choices=[1, 2, 3],
|
72 |
-
label="GAIA Benchmark Level",
|
73 |
-
interactive=True,
|
74 |
-
scale=1
|
75 |
-
)
|
76 |
-
ground_truth = gr.Textbox(
|
77 |
-
label="Ground Truth",
|
78 |
-
interactive=True,
|
79 |
-
scale=1
|
80 |
-
)
|
81 |
-
file_name = gr.Textbox(
|
82 |
-
label="File Name",
|
83 |
-
interactive=True,
|
84 |
-
scale=2
|
85 |
-
)
|
86 |
-
with gr.Row():
|
87 |
-
openai_api_key = gr.Textbox(
|
88 |
-
label="OpenAI API Key *",
|
89 |
-
type="password",
|
90 |
-
placeholder="sk‑...",
|
91 |
-
interactive=True
|
92 |
-
)
|
93 |
-
gemini_api_key = gr.Textbox(
|
94 |
-
label="Gemini API Key *",
|
95 |
-
type="password",
|
96 |
-
interactive=True
|
97 |
-
)
|
98 |
-
anthropic_api_key = gr.Textbox(
|
99 |
-
label="Anthropic API Key *",
|
100 |
-
type="password",
|
101 |
-
placeholder="sk‑ant-...",
|
102 |
-
interactive=True
|
103 |
-
)
|
104 |
-
with gr.Row():
|
105 |
-
clear_btn = gr.ClearButton(
|
106 |
-
components=[question, level, ground_truth, file_name]
|
107 |
-
)
|
108 |
-
submit_btn = gr.Button("Submit", variant="primary")
|
109 |
-
with gr.Column(scale=1):
|
110 |
-
answer = gr.Textbox(
|
111 |
-
label="Answer",
|
112 |
-
lines=1,
|
113 |
-
interactive=False
|
114 |
-
)
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
grady.launch(mcp_server=True)
|
|
|
56 |
|
57 |
with gr.Blocks() as grady:
|
58 |
gr.Markdown("## Grady - General AI Assistant")
|
|
|
59 |
|
60 |
+
with gr.Tab("Solution"):
|
61 |
+
gr.Markdown(os.environ.get("DESCRIPTION"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
+
with gr.Row():
|
64 |
+
with gr.Column(scale=3):
|
65 |
+
with gr.Row():
|
66 |
+
question = gr.Textbox(
|
67 |
+
label="Question *",
|
68 |
+
placeholder="In the 2025 Gradio Agents & MCP Hackathon, what percentage of participants submitted a solution during the last 24 hours?",
|
69 |
+
interactive=True
|
70 |
+
)
|
71 |
+
with gr.Row():
|
72 |
+
level = gr.Radio(
|
73 |
+
choices=[1, 2, 3],
|
74 |
+
label="GAIA Benchmark Level",
|
75 |
+
interactive=True,
|
76 |
+
scale=1
|
77 |
+
)
|
78 |
+
ground_truth = gr.Textbox(
|
79 |
+
label="Ground Truth",
|
80 |
+
interactive=True,
|
81 |
+
scale=1
|
82 |
+
)
|
83 |
+
file_name = gr.Textbox(
|
84 |
+
label="File Name",
|
85 |
+
interactive=True,
|
86 |
+
scale=2
|
87 |
+
)
|
88 |
+
with gr.Row():
|
89 |
+
openai_api_key = gr.Textbox(
|
90 |
+
label="OpenAI API Key *",
|
91 |
+
type="password",
|
92 |
+
placeholder="sk‑...",
|
93 |
+
interactive=True
|
94 |
+
)
|
95 |
+
gemini_api_key = gr.Textbox(
|
96 |
+
label="Gemini API Key *",
|
97 |
+
type="password",
|
98 |
+
interactive=True
|
99 |
+
)
|
100 |
+
anthropic_api_key = gr.Textbox(
|
101 |
+
label="Anthropic API Key *",
|
102 |
+
type="password",
|
103 |
+
placeholder="sk-ant-...",
|
104 |
+
interactive=True
|
105 |
+
)
|
106 |
+
with gr.Row():
|
107 |
+
clear_btn = gr.ClearButton(
|
108 |
+
components=[question, level, ground_truth, file_name]
|
109 |
+
)
|
110 |
+
submit_btn = gr.Button("Submit", variant="primary")
|
111 |
+
with gr.Column(scale=1):
|
112 |
+
answer = gr.Textbox(
|
113 |
+
label="Answer",
|
114 |
+
lines=1,
|
115 |
+
interactive=False
|
116 |
+
)
|
117 |
|
118 |
+
submit_btn.click(
|
119 |
+
fn=ask,
|
120 |
+
inputs=[question, openai_api_key, gemini_api_key, anthropic_api_key, file_name],
|
121 |
+
outputs=answer
|
122 |
+
)
|
123 |
+
|
124 |
+
QUESTION_FILE_PATH = "data/gaia_validation.jsonl"
|
125 |
+
|
126 |
+
gr.Examples(
|
127 |
+
label="GAIA Benchmark Level 1 Problems",
|
128 |
+
examples=get_questions(QUESTION_FILE_PATH, 1),
|
129 |
+
inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
|
130 |
+
outputs=answer,
|
131 |
+
cache_examples=False
|
132 |
+
)
|
133 |
+
|
134 |
+
gr.Examples(
|
135 |
+
label="GAIA Benchmark Level 2 Problems",
|
136 |
+
examples=get_questions(QUESTION_FILE_PATH, 2),
|
137 |
+
inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
|
138 |
+
outputs=answer,
|
139 |
+
cache_examples=False
|
140 |
+
)
|
141 |
+
|
142 |
+
gr.Examples(
|
143 |
+
label="GAIA Benchmark Level 3 Problems",
|
144 |
+
examples=get_questions(QUESTION_FILE_PATH, 3),
|
145 |
+
inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
|
146 |
+
outputs=answer,
|
147 |
+
cache_examples=False
|
148 |
+
)
|
149 |
+
with gr.Tab("Documentation"):
|
150 |
+
gr.Markdown(os.environ.get("DOCUMENTATION"))
|
151 |
|
152 |
grady.launch(mcp_server=True)
|