|
Download README.md from bhanuprakashg/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 2.46 kB
-
https://huggingface.co/spaces/bhanuprakashg/Final_Assignment_Template/resolve/main/README.md
- Command line
-
hf download hf://spaces/bhanuprakashg/Final_Assignment_Template/README.md
-
curl -L -o README.md https://huggingface.co/spaces/bhanuprakashg/Final_Assignment_Template/resolve/main/README.md
2.46 kB
A newer version of the Gradio SDK is available: 6.33.0
metadata
title: Template Final Assignment
emoji: 🕵🏻♂️
colorFrom: indigo
colorTo: indigo
sdk: gradio
sdk_version: 5.25.2
app_file: app.py
pinned: false
hf_oauth: true
hf_oauth_expiration_minutes: 480
GAIA Agent (HF Agents Course Final Assignment)
A LangGraph ReAct agent (Gemini + tools) that answers the GAIA questions served by the course scoring API and submits the answers.
How it works (per question)
app.pyfetches all questions from/questionsand loops over them.- If a question has an attachment, it is downloaded from
/files/{task_id}and its local path is appended to the question. - The question goes to the LangGraph agent in
agent.py:assistant (Gemini) <-> toolsloop, guided bysystem_prompt.txt. - The agent picks tools as needed: web search (Tavily), Wikipedia, arXiv, webpage fetch, YouTube transcript, file reader (csv/xlsx/pdf/txt), Python executor, image analysis, audio transcription.
- When done, the model writes
FINAL ANSWER: ...; only the text after it is kept (exact-match grading). - Failed calls are retried up to 3 times; all answers are POSTed to
/submitand the score is shown.
Run on the Hugging Face Space
- Space Settings -> Variables and secrets, add secrets:
GEMINI_API_KEY,TAVILY_API_KEY,HF_TOKEN. - Open the Space, click Sign in with Hugging Face, then Run Evaluation & Submit All Answers. It takes several minutes.
Run locally from scratch
git clone https://huggingface.co/spaces/bhanuprakashg/Final_Assignment_Template
cd Final_Assignment_Template
python3 -m venv .venv # create environment
source .venv/bin/activate # activate it (Windows: .venv\Scripts\activate)
pip install -r requirements.txt # install dependencies
cat > .env <<'EOF2'
GEMINI_API_KEY=your_gemini_key
TAVILY_API_KEY=your_tavily_key
HF_TOKEN=your_hf_token
EOF2
python agent.py # quick agent smoke test
python app.py # start the Gradio UI at http://127.0.0.1:7860
Note: the OAuth login is mocked locally (needs huggingface-cli login); real submission is easiest from the Space.
Files
app.py- Gradio UI, question fetching, file download, submissionagent.py- LangGraph agent, tools, answer extractionsystem_prompt.txt- GAIA answer-format promptrequirements.txt- dependencies (.envis gitignored; never commit keys)