Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,17 +2,16 @@ import os
|
|
2 |
import gradio as gr
|
3 |
import requests
|
4 |
import pandas as pd
|
5 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool
|
6 |
-
from transformers import pipeline
|
7 |
|
8 |
# --- Constants ---
|
9 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
10 |
-
|
11 |
|
12 |
# --- Define Agent ---
|
13 |
class SmolAgentWrapper:
|
14 |
def __init__(self):
|
15 |
-
self.model =
|
16 |
self.tools = [DuckDuckGoSearchTool()] # You can add more tools here
|
17 |
self.agent = CodeAgent(model=self.model, tools=self.tools)
|
18 |
|
|
|
2 |
import gradio as gr
|
3 |
import requests
|
4 |
import pandas as pd
|
5 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool,TransformersModel
|
|
|
6 |
|
7 |
# --- Constants ---
|
8 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
9 |
+
|
10 |
|
11 |
# --- Define Agent ---
|
12 |
class SmolAgentWrapper:
|
13 |
def __init__(self):
|
14 |
+
self.model = TransformersModel(model_id="gpt2") # Uses flan-t5-base via HF Inference API
|
15 |
self.tools = [DuckDuckGoSearchTool()] # You can add more tools here
|
16 |
self.agent = CodeAgent(model=self.model, tools=self.tools)
|
17 |
|