Update app.py
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 TransformersModel, DuckDuckGoSearchTool, CodeAgent
|
| 7 |
|
| 8 |
|
| 9 |
# (Keep Constants as is)
|
|
@@ -15,14 +15,20 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 15 |
class BasicAgent:
|
| 16 |
def __init__(self):
|
| 17 |
print("Initializing BasicAgent.")
|
| 18 |
-
model_id = "Qwen/Qwen2.5-7B-Instruct-1M"
|
| 19 |
|
| 20 |
-
self.model =
|
| 21 |
model_id=model_id,
|
| 22 |
-
|
| 23 |
-
device_map="auto"
|
| 24 |
)
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
search_tool = DuckDuckGoSearchTool()
|
| 27 |
|
| 28 |
self.agent = CodeAgent(
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
from smolagents import TransformersModel, DuckDuckGoSearchTool, CodeAgent, LiteLLMModel
|
| 7 |
|
| 8 |
|
| 9 |
# (Keep Constants as is)
|
|
|
|
| 15 |
class BasicAgent:
|
| 16 |
def __init__(self):
|
| 17 |
print("Initializing BasicAgent.")
|
| 18 |
+
model_id = "gemini/gemini-2.0-flash" # "Qwen/Qwen2.5-7B-Instruct-1M"
|
| 19 |
|
| 20 |
+
self.model = LiteLLMModel(
|
| 21 |
model_id=model_id,
|
| 22 |
+
api_key=os.environ.get('GOOGLE_API_KEY')
|
|
|
|
| 23 |
)
|
| 24 |
|
| 25 |
+
|
| 26 |
+
# self.model = TransformersModel(
|
| 27 |
+
# model_id=model_id,
|
| 28 |
+
# max_new_tokens=4096,
|
| 29 |
+
# device_map="auto"
|
| 30 |
+
#)
|
| 31 |
+
|
| 32 |
search_tool = DuckDuckGoSearchTool()
|
| 33 |
|
| 34 |
self.agent = CodeAgent(
|