Commit ·
2982d6f
1
Parent(s): ceba91c
Fix import error.
Browse files- app.py +7 -3
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import os
|
|
| 2 |
from pathlib import Path
|
| 3 |
import gradio as gr
|
| 4 |
import requests
|
| 5 |
-
|
| 6 |
from llama_index.llms.gemini import Gemini
|
| 7 |
from llama_index.core.agent.workflow import ReActAgent
|
| 8 |
from llama_index.core.tools import FunctionTool
|
|
@@ -64,12 +64,16 @@ def fetch_questions(api_url: str = DEFAULT_API_URL):
|
|
| 64 |
questions_url = f"{api_url}/questions"
|
| 65 |
print(f"Fetching questions from: {questions_url}")
|
| 66 |
response = requests.get(questions_url, timeout=15)
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
questions_data = response.json()
|
| 69 |
return questions_data
|
| 70 |
|
| 71 |
|
| 72 |
-
async def run_and_submit_all(
|
| 73 |
"""
|
| 74 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
| 75 |
and displays the results.
|
|
|
|
| 2 |
from pathlib import Path
|
| 3 |
import gradio as gr
|
| 4 |
import requests
|
| 5 |
+
import pandas as pd
|
| 6 |
from llama_index.llms.gemini import Gemini
|
| 7 |
from llama_index.core.agent.workflow import ReActAgent
|
| 8 |
from llama_index.core.tools import FunctionTool
|
|
|
|
| 64 |
questions_url = f"{api_url}/questions"
|
| 65 |
print(f"Fetching questions from: {questions_url}")
|
| 66 |
response = requests.get(questions_url, timeout=15)
|
| 67 |
+
try:
|
| 68 |
+
response.raise_for_status()
|
| 69 |
+
except Exception:
|
| 70 |
+
print(f"Response text: {response.text[:500]}")
|
| 71 |
+
raise
|
| 72 |
questions_data = response.json()
|
| 73 |
return questions_data
|
| 74 |
|
| 75 |
|
| 76 |
+
async def run_and_submit_all(profile: gr.OAuthProfile | None):
|
| 77 |
"""
|
| 78 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
| 79 |
and displays the results.
|
requirements.txt
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
dotenv
|
| 2 |
gradio
|
| 3 |
requests
|
|
|
|
| 4 |
llama-index
|
| 5 |
llama-index-llms-gemini
|
| 6 |
llama-index-tools-duckduckgo
|
|
|
|
| 1 |
dotenv
|
| 2 |
gradio
|
| 3 |
requests
|
| 4 |
+
pandas
|
| 5 |
llama-index
|
| 6 |
llama-index-llms-gemini
|
| 7 |
llama-index-tools-duckduckgo
|