PritRai75's picture
Upload 7 files
42e917a verified
|
Raw History Blame
2.1 kB
metadata
title: GAIA Agent 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 (Hugging Face Agents Course, Unit 4)

A smolagents CodeAgent that answers the 20 GAIA level-1 questions from the course scoring API. Target: 30% or more.

Files

File What it does
app.py Gradio UI: log in, run the agent (answers cached), submit separately
agent.py Model selection, agent instructions, answer clean-up for exact match
tools.py Web search, webpage reader, Wikipedia (tables kept), YouTube transcript, file reader, Whisper transcription, Python script runner
gaia_api.py Scoring API client and the answers_cache.json cache
run_local.py Test single questions on a laptop or Colab without submitting

Set up the Space

  1. Create a new Gradio Space (or duplicate the course template) and upload these files. Keep the Space public: the submission includes a link to its code.
  2. In Settings β†’ Variables and secrets add:
    • MODEL_ID (variable), for example:
      • gemini/gemini-2.5-flash plus secret GEMINI_API_KEY
      • openai/gpt-4.1-mini plus secret OPENAI_API_KEY
      • openrouter/<model> plus secret OPENROUTER_API_KEY
      • a Hugging Face model id plus secret HF_TOKEN (optional variable HF_PROVIDER)
    • TAVILY_API_KEY (optional secret): more reliable search than DuckDuckGo, which often rate-limits shared Space IPs.
    • MAX_STEPS (optional, default 12), WHISPER_MODEL (optional, default base).
  3. Open the app, log in, press Run agent, check the table, press Submit cached answers.

For questions with an image attached, the model must accept images (Gemini and GPT-4.1 models do). Otherwise the agent retries without the image.

Test locally first

pip install -r requirements.txt
export MODEL_ID=gemini/gemini-2.5-flash GEMINI_API_KEY=...
python run_local.py --list
python run_local.py --task <task-id-prefix>