bstraehle commited on
Commit
666d299
·
verified ·
1 Parent(s): 19dee04

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +89 -85
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.Row():
62
- with gr.Column(scale=3):
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
- submit_btn.click(
117
- fn=ask,
118
- inputs=[question, openai_api_key, gemini_api_key, anthropic_api_key, file_name],
119
- outputs=answer
120
- )
121
-
122
- QUESTION_FILE_PATH = "data/gaia_validation.jsonl"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
- gr.Examples(
125
- label="GAIA Benchmark Level 1 Problems",
126
- examples=get_questions(QUESTION_FILE_PATH, 1),
127
- inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
128
- outputs=answer,
129
- cache_examples=False
130
- )
131
-
132
- gr.Examples(
133
- label="GAIA Benchmark Level 2 Problems",
134
- examples=get_questions(QUESTION_FILE_PATH, 2),
135
- inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
136
- outputs=answer,
137
- cache_examples=False
138
- )
139
-
140
- gr.Examples(
141
- label="GAIA Benchmark Level 3 Problems",
142
- examples=get_questions(QUESTION_FILE_PATH, 3),
143
- inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
144
- outputs=answer,
145
- cache_examples=False
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)