Update app.py
Browse files
app.py
CHANGED
@@ -42,17 +42,19 @@ class BasicAgent:
|
|
42 |
|
43 |
# --- Gradio UI and Logic ---
|
44 |
|
45 |
-
def run_and_submit_all(
|
46 |
"""
|
47 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
48 |
and displays the results.
|
49 |
"""
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
56 |
questions_url = f"{api_url}/questions"
|
57 |
submit_url = f"{api_url}/submit"
|
58 |
|
@@ -179,9 +181,7 @@ with gr.Blocks() as demo:
|
|
179 |
"submit all answers at once, and display the results."
|
180 |
)
|
181 |
|
182 |
-
|
183 |
-
api_url_input = gr.Textbox(label="FastAPI API URL", value=DEFAULT_API_URL)
|
184 |
-
hf_username_input = gr.Textbox(label="Hugging Face Username")
|
185 |
|
186 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
187 |
|
@@ -191,7 +191,6 @@ with gr.Blocks() as demo:
|
|
191 |
# --- Component Interaction ---
|
192 |
run_button.click(
|
193 |
fn=run_and_submit_all,
|
194 |
-
inputs=[api_url_input, hf_username_input],
|
195 |
outputs=[status_output, results_table]
|
196 |
)
|
197 |
|
|
|
42 |
|
43 |
# --- Gradio UI and Logic ---
|
44 |
|
45 |
+
def run_and_submit_all( profile gr.OAuthProfile , api_url: str):
|
46 |
"""
|
47 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
48 |
and displays the results.
|
49 |
"""
|
50 |
+
|
51 |
+
if profile:
|
52 |
+
username= f"{profile.name}"
|
53 |
+
|
54 |
+
else:
|
55 |
+
return "Please Login to Hugging Face with the button.", None
|
56 |
+
|
57 |
+
api_url = DEFAULT_API_URL
|
58 |
questions_url = f"{api_url}/questions"
|
59 |
submit_url = f"{api_url}/submit"
|
60 |
|
|
|
181 |
"submit all answers at once, and display the results."
|
182 |
)
|
183 |
|
184 |
+
gr.LoginButton()
|
|
|
|
|
185 |
|
186 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
187 |
|
|
|
191 |
# --- Component Interaction ---
|
192 |
run_button.click(
|
193 |
fn=run_and_submit_all,
|
|
|
194 |
outputs=[status_output, results_table]
|
195 |
)
|
196 |
|