Thanh Vinh Vo
commited on
Commit
·
f1a07b1
1
Parent(s):
5f8598a
update
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import inspect
|
| 2 |
-
import os
|
| 3 |
import json
|
|
|
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
import pandas as pd
|
| 6 |
import requests
|
|
@@ -32,16 +33,15 @@ class BasicAgent:
|
|
| 32 |
DuckDuckGoSearchTool(),
|
| 33 |
],
|
| 34 |
model=InferenceClientModel(
|
| 35 |
-
model_id="
|
| 36 |
),
|
| 37 |
additional_authorized_imports=[
|
| 38 |
"requests",
|
| 39 |
"bs4",
|
| 40 |
"markdownify",
|
| 41 |
"wikipedia",
|
| 42 |
-
"pandas"
|
| 43 |
],
|
| 44 |
-
max_steps=25
|
| 45 |
)
|
| 46 |
|
| 47 |
def __call__(self, question: str) -> str:
|
|
@@ -97,7 +97,11 @@ def run_and_submit_all(questions_index: str, profile: gr.OAuthProfile | None):
|
|
| 97 |
try:
|
| 98 |
response = requests.get(questions_url, timeout=15)
|
| 99 |
response.raise_for_status()
|
| 100 |
-
questions_data =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
if not questions_data:
|
| 102 |
print("Fetched questions list is empty.")
|
| 103 |
return "Fetched questions list is empty or invalid format.", None
|
|
@@ -224,7 +228,10 @@ with gr.Blocks() as demo:
|
|
| 224 |
gr.LoginButton()
|
| 225 |
|
| 226 |
questions_limit = gr.Textbox(
|
| 227 |
-
label="Question index to solve (-1 to solve all)",
|
|
|
|
|
|
|
|
|
|
| 228 |
)
|
| 229 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 230 |
status_output = gr.Textbox(
|
|
|
|
| 1 |
import inspect
|
|
|
|
| 2 |
import json
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
import gradio as gr
|
| 6 |
import pandas as pd
|
| 7 |
import requests
|
|
|
|
| 33 |
DuckDuckGoSearchTool(),
|
| 34 |
],
|
| 35 |
model=InferenceClientModel(
|
| 36 |
+
model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 37 |
),
|
| 38 |
additional_authorized_imports=[
|
| 39 |
"requests",
|
| 40 |
"bs4",
|
| 41 |
"markdownify",
|
| 42 |
"wikipedia",
|
| 43 |
+
"pandas",
|
| 44 |
],
|
|
|
|
| 45 |
)
|
| 46 |
|
| 47 |
def __call__(self, question: str) -> str:
|
|
|
|
| 97 |
try:
|
| 98 |
response = requests.get(questions_url, timeout=15)
|
| 99 |
response.raise_for_status()
|
| 100 |
+
questions_data = (
|
| 101 |
+
[response.json()[QUESTION_INDEX]]
|
| 102 |
+
if QUESTION_INDEX >= 0
|
| 103 |
+
else response.json()
|
| 104 |
+
)
|
| 105 |
if not questions_data:
|
| 106 |
print("Fetched questions list is empty.")
|
| 107 |
return "Fetched questions list is empty or invalid format.", None
|
|
|
|
| 228 |
gr.LoginButton()
|
| 229 |
|
| 230 |
questions_limit = gr.Textbox(
|
| 231 |
+
label="Question index to solve (-1 to solve all)",
|
| 232 |
+
lines=1,
|
| 233 |
+
interactive=True,
|
| 234 |
+
value="0",
|
| 235 |
)
|
| 236 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 237 |
status_output = gr.Textbox(
|