Spaces:
Sleeping
Sleeping
Add gemini model
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, VisitWebpageTool, FinalAnswerTool
|
| 7 |
|
| 8 |
# (Keep Constants as is)
|
| 9 |
# --- Constants ---
|
|
@@ -13,8 +13,14 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 13 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 14 |
class BasicAgent:
|
| 15 |
def __init__(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
self.agent = CodeAgent(
|
| 17 |
-
model=
|
| 18 |
tools=[DuckDuckGoSearchTool(), VisitWebpageTool(), FinalAnswerTool()],
|
| 19 |
max_steps=5,
|
| 20 |
)
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, OpenAIServerModel, VisitWebpageTool, FinalAnswerTool
|
| 7 |
|
| 8 |
# (Keep Constants as is)
|
| 9 |
# --- Constants ---
|
|
|
|
| 13 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 14 |
class BasicAgent:
|
| 15 |
def __init__(self):
|
| 16 |
+
# self.model = HfApiModel(model="Qwen/Qwen2.5-VL-72B-Instruct"),
|
| 17 |
+
self.moedl = model = OpenAIServerModel(
|
| 18 |
+
model_id="gemini-2.5-flash-preview-05-20",
|
| 19 |
+
api_base="https://generativelanguage.googleapis.com/v1beta/openai/",
|
| 20 |
+
api_key=os.environ["GEMINI_API_KEY"],
|
| 21 |
+
)
|
| 22 |
self.agent = CodeAgent(
|
| 23 |
+
model=self.model,
|
| 24 |
tools=[DuckDuckGoSearchTool(), VisitWebpageTool(), FinalAnswerTool()],
|
| 25 |
max_steps=5,
|
| 26 |
)
|