Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,12 @@ import inspect
|
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
|
| 8 |
-
from smolagents import CodeAgent, WebSearchTool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# (Keep Constants as is)
|
| 11 |
# --- Constants ---
|
|
@@ -20,7 +25,10 @@ class BasicAgent:
|
|
| 20 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 21 |
fixed_answer = "This is a default answer."
|
| 22 |
|
| 23 |
-
model = InferenceClientModel()
|
|
|
|
|
|
|
|
|
|
| 24 |
agent = CodeAgent(tools=[WebSearchTool()], model=model, stream_outputs=True)
|
| 25 |
custom_answer = agent.run("How many seconds would it take for a leopard at full speed to run through Pont des Arts?")
|
| 26 |
|
|
|
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
|
| 8 |
+
from smolagents import CodeAgent, WebSearchTool#, InferenceClientModel
|
| 9 |
+
|
| 10 |
+
# Load model directly
|
| 11 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 12 |
+
|
| 13 |
+
|
| 14 |
|
| 15 |
# (Keep Constants as is)
|
| 16 |
# --- Constants ---
|
|
|
|
| 25 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 26 |
fixed_answer = "This is a default answer."
|
| 27 |
|
| 28 |
+
#model = InferenceClientModel()
|
| 29 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-32B-Instruct")
|
| 30 |
+
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-32B-Instruct")
|
| 31 |
+
|
| 32 |
agent = CodeAgent(tools=[WebSearchTool()], model=model, stream_outputs=True)
|
| 33 |
custom_answer = agent.run("How many seconds would it take for a leopard at full speed to run through Pont des Arts?")
|
| 34 |
|