Update app.py to remove model loading
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import requests
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
|
|
|
| 7 |
import datetime
|
| 8 |
import requests
|
| 9 |
import pytz
|
|
@@ -27,32 +28,32 @@ class BasicAgent:
|
|
| 27 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 28 |
|
| 29 |
|
| 30 |
-
model = HfApiModel(
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
)
|
| 36 |
-
|
| 37 |
-
with open("prompts.yaml", 'r') as stream:
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
agent = CodeAgent(
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
)
|
| 52 |
-
|
| 53 |
-
agent_answer = agent.run(question)
|
| 54 |
-
|
| 55 |
-
print(f"Agent Answer: {agent_answer}")
|
| 56 |
|
| 57 |
return fixed_answer
|
| 58 |
|
|
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 7 |
+
from smolagents.models import OllamaModel
|
| 8 |
import datetime
|
| 9 |
import requests
|
| 10 |
import pytz
|
|
|
|
| 28 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 29 |
|
| 30 |
|
| 31 |
+
# model = HfApiModel(
|
| 32 |
+
# max_tokens=2096,
|
| 33 |
+
# temperature=0.0,
|
| 34 |
+
# model_id="google/gemma-2b-it",# it is possible that this model may be overloaded
|
| 35 |
+
# custom_role_conversions=None,
|
| 36 |
+
# )
|
| 37 |
+
|
| 38 |
+
# with open("prompts.yaml", 'r') as stream:
|
| 39 |
+
# prompt_templates = yaml.safe_load(stream)
|
| 40 |
+
|
| 41 |
+
# agent = CodeAgent(
|
| 42 |
+
# model=model,
|
| 43 |
+
# # tools=[DuckDuckGoSearchTool()],
|
| 44 |
+
# tools=[],
|
| 45 |
+
# max_steps=5,
|
| 46 |
+
# verbosity_level=1,
|
| 47 |
+
# grammar=None,
|
| 48 |
+
# planning_interval=None,
|
| 49 |
+
# name=None,
|
| 50 |
+
# description=None,
|
| 51 |
+
# prompt_templates=prompt_templates
|
| 52 |
+
# )
|
| 53 |
+
|
| 54 |
+
# agent_answer = agent.run(question)
|
| 55 |
+
|
| 56 |
+
# print(f"Agent Answer: {agent_answer}")
|
| 57 |
|
| 58 |
return fixed_answer
|
| 59 |
|