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