Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,15 @@
|
|
| 1 |
import os
|
| 2 |
import re
|
| 3 |
-
import json
|
| 4 |
import gradio as gr
|
| 5 |
import requests
|
| 6 |
import pandas as pd
|
| 7 |
-
from urllib.parse import quote
|
| 8 |
from bs4 import BeautifulSoup
|
| 9 |
-
from dotenv import load_dotenv
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# (Keep Constants as is)
|
| 14 |
# --- Constants ---
|
|
@@ -312,17 +313,12 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 312 |
|
| 313 |
# --- Build Gradio Interface using Blocks ---
|
| 314 |
with gr.Blocks() as demo:
|
| 315 |
-
gr.Markdown("#
|
| 316 |
gr.Markdown(
|
| 317 |
"""
|
| 318 |
-
**
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
|
| 322 |
-
---
|
| 323 |
-
**Disclaimers:**
|
| 324 |
-
Once clicking on the "submit button, it can take quite some time ( this is the time for the agent to go through all the questions).
|
| 325 |
-
This space provides a basic setup and is intentionally sub-optimal to encourage you to develop your own, more robust solution. For instance for the delay process of the submit button, a solution could be to cache the answers and submit in a seperate action or even to answer the questions in async.
|
| 326 |
"""
|
| 327 |
)
|
| 328 |
|
|
|
|
| 1 |
import os
|
| 2 |
import re
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
import requests
|
| 5 |
import pandas as pd
|
|
|
|
| 6 |
from bs4 import BeautifulSoup
|
|
|
|
| 7 |
|
| 8 |
+
try:
|
| 9 |
+
from dotenv import load_dotenv
|
| 10 |
+
load_dotenv()
|
| 11 |
+
except ImportError:
|
| 12 |
+
pass # .env not loaded; use os.getenv (e.g. HF Secrets)
|
| 13 |
|
| 14 |
# (Keep Constants as is)
|
| 15 |
# --- Constants ---
|
|
|
|
| 313 |
|
| 314 |
# --- Build Gradio Interface using Blocks ---
|
| 315 |
with gr.Blocks() as demo:
|
| 316 |
+
gr.Markdown("# ReAct Agent Evaluation Runner")
|
| 317 |
gr.Markdown(
|
| 318 |
"""
|
| 319 |
+
**Multi-step ReAct agent:** Plan → Act (tools) → Observe → Reflect. The agent has access to:
|
| 320 |
+
**DuckDuckGo search**, **web page view**, and **code agent** (safe Python). Set `HF_TOKEN` in Secrets (or .env) to enable the LLM.
|
| 321 |
+
1. Log in with the button below. 2. Click 'Run Evaluation & Submit All Answers'. Submission can take a while while the agent runs on all questions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
"""
|
| 323 |
)
|
| 324 |
|