bstraehle commited on
Commit
fc406e5
·
verified ·
1 Parent(s): 32d873a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +86 -91
app.py CHANGED
@@ -52,99 +52,94 @@ def ask(question, openai_api_key, gemini_api_key, anthropic_api_key, file_name =
52
  with gr.Blocks() as gaia:
53
  gr.Markdown("## GAIA - General AI Assistant")
54
 
55
- with gr.Tab("Solution"):
56
- gr.Markdown(os.environ.get("DESCRIPTION"))
57
 
58
- with gr.Row():
59
- with gr.Column(scale=3):
60
- with gr.Row():
61
- question = gr.Textbox(
62
- label="Question *",
63
- placeholder="In \"MCP's 1st Birthday Hackathon - Hosted by Anthropic and Gradio\", what percentage of participants submitted a solution so far?",
64
- value="Black to move. Without moving the black queens, which sequence is mate in 2 for black, regardless of what white does? Use standard chess notation, leaving out the white move.",
65
- interactive=True
66
- )
67
- with gr.Row():
68
- level = gr.Radio(
69
- choices=[1, 2, 3],
70
- label="GAIA Benchmark Level",
71
- interactive=True,
72
- scale=1
73
- )
74
- ground_truth = gr.Textbox(
75
- label="Ground Truth",
76
- value="Rxf3, Rf1#",
77
- interactive=True,
78
- scale=1
79
- )
80
- file_name = gr.Textbox(
81
- label="File Name",
82
- value="hle-6687ffb1091058ff19128813.jpg",
83
- interactive=True
84
- )
85
- with gr.Row():
86
- openai_api_key = gr.Textbox(
87
- label="OpenAI API Key *",
88
- type="password",
89
- placeholder="sk‑...",
90
- interactive=True
91
- )
92
- gemini_api_key = gr.Textbox(
93
- label="Gemini API Key *",
94
- type="password",
95
- interactive=True
96
- )
97
- anthropic_api_key = gr.Textbox(
98
- label="Anthropic API Key *",
99
- type="password",
100
- placeholder="sk-ant-...",
101
- interactive=True
102
- )
103
- with gr.Row():
104
- clear_btn = gr.ClearButton(
105
- components=[question, level, ground_truth, file_name]
106
- )
107
- submit_btn = gr.Button("Submit", variant="primary")
108
- with gr.Column(scale=1):
109
- answer = gr.Textbox(
110
- label="Answer",
111
- interactive=False
112
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
 
114
- submit_btn.click(
115
- fn=ask,
116
- inputs=[question, openai_api_key, gemini_api_key, anthropic_api_key, file_name],
117
- outputs=answer
118
- )
119
-
120
- QUESTION_FILE_PATH = "data/gaia_validation.jsonl"
121
-
122
- gr.Examples(
123
- label="GAIA Benchmark Level 1 Problems",
124
- examples=get_questions(QUESTION_FILE_PATH, 1),
125
- inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
126
- outputs=answer,
127
- cache_examples=False
128
- )
129
-
130
- gr.Examples(
131
- label="GAIA Benchmark Level 2 Problems",
132
- examples=get_questions(QUESTION_FILE_PATH, 2),
133
- inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
134
- outputs=answer,
135
- cache_examples=False
136
- )
137
-
138
- gr.Examples(
139
- label="GAIA Benchmark Level 3 Problems",
140
- examples=get_questions(QUESTION_FILE_PATH, 3),
141
- inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
142
- outputs=answer,
143
- cache_examples=False
144
- )
145
 
146
- with gr.Tab("Documentation"):
147
- gr.Markdown(os.environ.get("DOCUMENTATION"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
- if __name__ == "__main__":
150
- gaia.launch(mcp_server=True, share=False, ssr_mode=False)
 
52
  with gr.Blocks() as gaia:
53
  gr.Markdown("## GAIA - General AI Assistant")
54
 
55
+ gr.Markdown(os.environ.get("DESCRIPTION"))
 
56
 
57
+ with gr.Row():
58
+ with gr.Column(scale=3):
59
+ with gr.Row():
60
+ question = gr.Textbox(
61
+ label="Question *",
62
+ placeholder="In \"MCP's 1st Birthday Hackathon - Hosted by Anthropic and Gradio\", what percentage of participants submitted a solution so far?",
63
+ value="Black to move. Without moving the black queens, which sequence is mate in 2 for black, regardless of what white does? Use standard chess notation, leaving out the white move.",
64
+ interactive=True
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  )
66
+ with gr.Row():
67
+ level = gr.Radio(
68
+ choices=[1, 2, 3],
69
+ label="GAIA Benchmark Level",
70
+ interactive=True,
71
+ scale=1
72
+ )
73
+ ground_truth = gr.Textbox(
74
+ label="Ground Truth",
75
+ value="Rxf3, Rf1#",
76
+ interactive=True,
77
+ scale=1
78
+ )
79
+ file_name = gr.Textbox(
80
+ label="File Name",
81
+ value="hle-6687ffb1091058ff19128813.jpg",
82
+ interactive=True
83
+ )
84
+ with gr.Row():
85
+ openai_api_key = gr.Textbox(
86
+ label="OpenAI API Key *",
87
+ type="password",
88
+ placeholder="sk‑...",
89
+ interactive=True
90
+ )
91
+ gemini_api_key = gr.Textbox(
92
+ label="Gemini API Key *",
93
+ type="password",
94
+ interactive=True
95
+ )
96
+ anthropic_api_key = gr.Textbox(
97
+ label="Anthropic API Key *",
98
+ type="password",
99
+ placeholder="sk-ant-...",
100
+ interactive=True
101
+ )
102
+ with gr.Row():
103
+ clear_btn = gr.ClearButton(
104
+ components=[question, level, ground_truth, file_name]
105
+ )
106
+ submit_btn = gr.Button("Submit", variant="primary")
107
+ with gr.Column(scale=1):
108
+ answer = gr.Textbox(
109
+ label="Answer",
110
+ interactive=False
111
+ )
112
 
113
+ submit_btn.click(
114
+ fn=ask,
115
+ inputs=[question, openai_api_key, gemini_api_key, anthropic_api_key, file_name],
116
+ outputs=answer
117
+ )
118
+
119
+ QUESTION_FILE_PATH = "data/gaia_validation.jsonl"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
+ gr.Examples(
122
+ label="GAIA Benchmark Level 1 Problems",
123
+ examples=get_questions(QUESTION_FILE_PATH, 1),
124
+ inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
125
+ outputs=answer,
126
+ cache_examples=False
127
+ )
128
+
129
+ gr.Examples(
130
+ label="GAIA Benchmark Level 2 Problems",
131
+ examples=get_questions(QUESTION_FILE_PATH, 2),
132
+ inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
133
+ outputs=answer,
134
+ cache_examples=False
135
+ )
136
+
137
+ gr.Examples(
138
+ label="GAIA Benchmark Level 3 Problems",
139
+ examples=get_questions(QUESTION_FILE_PATH, 3),
140
+ inputs=[question, level, ground_truth, file_name, openai_api_key, gemini_api_key, anthropic_api_key],
141
+ outputs=answer,
142
+ cache_examples=False
143
+ )
144
 
145
+ gaia.launch(mcp_server=True, share=False, ssr_mode=False)