Spaces:
Sleeping
Sleeping
init
Browse files- app.py +23 -0
- requirements.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, GradioUI, InferenceClientModel, LiteLLMModel
|
| 3 |
+
|
| 4 |
+
USE_LOCAL_MODEL = os.getenv("USE_LOCAL_MODEL", "false").lower() == "true"
|
| 5 |
+
|
| 6 |
+
if USE_LOCAL_MODEL:
|
| 7 |
+
model = LiteLLMModel(
|
| 8 |
+
model_id="ollama_chat/llama3.2",
|
| 9 |
+
api_base="http://localhost:11434",
|
| 10 |
+
)
|
| 11 |
+
else:
|
| 12 |
+
model = InferenceClientModel(
|
| 13 |
+
model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 14 |
+
max_tokens=8192,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
agent = CodeAgent(
|
| 18 |
+
tools=[DuckDuckGoSearchTool()],
|
| 19 |
+
model=model,
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
if __name__ == "__main__":
|
| 23 |
+
GradioUI(agent).launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
smolagents
|
| 2 |
+
ddgs
|
| 3 |
+
litellm
|