BlueGod01 commited on
Commit
e279847
·
verified ·
1 Parent(s): c5afee0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -2,10 +2,9 @@ import os
2
  import gradio as gr
3
  from PIL import Image
4
  from smolagents import (
5
- CodeAgent,
6
- InferenceClientModel,
7
- DuckDuckGoSearchTool,
8
- # visit_webpage,
9
  Tool
10
  )
11
  import requests
@@ -66,11 +65,17 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
66
  image_generation_tool
67
  ]
68
 
69
- # 5. Initialize HfApiModel with the top-tier open-source GAIA benchmark model
70
- # Qwen2.5-72B-Instruct provides elite multi-step execution logic over Serverless API infrastructure.
71
- model = InferenceClientModel(model_id="Qwen/Qwen2.5-72B-Instruct")
 
 
 
 
 
 
72
 
73
- # 6. Initialize the CodeAgent with the Serverless API backbone
74
  agent = CodeAgent(
75
  tools=all_tools,
76
  model=model,
 
2
  import gradio as gr
3
  from PIL import Image
4
  from smolagents import (
5
+ CodeAgent,
6
+ LiteLLMModel, # <-- NEW: for Gemini
7
+ DuckDuckGoSearchTool,
 
8
  Tool
9
  )
10
  import requests
 
65
  image_generation_tool
66
  ]
67
 
68
+ # 5. Initialize Google Gemini 2.0 Flash model using LiteLLMModel
69
+ # The API key must be stored as a secret named GEMINI_API_KEY in the HF Space.
70
+ gemini_api_key = os.getenv("GEMINI_API_KEY")
71
+ if not gemini_api_key:
72
+ raise ValueError("GEMINI_API_KEY environment variable not set. Please add it to Hugging Face Space secrets.")
73
+ model = LiteLLMModel(
74
+ model_id="gemini/gemini-2.0-flash",
75
+ api_key=gemini_api_key
76
+ )
77
 
78
+ # 6. Initialize the CodeAgent with the Gemini model
79
  agent = CodeAgent(
80
  tools=all_tools,
81
  model=model,