Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,17 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
|
| 3 |
import os
|
| 4 |
-
import re
|
| 5 |
import ast
|
| 6 |
import operator
|
| 7 |
import datetime
|
| 8 |
import pytz
|
| 9 |
import json
|
|
|
|
| 10 |
import requests
|
| 11 |
-
import yaml
|
| 12 |
import pandas as pd
|
| 13 |
import gradio as gr
|
| 14 |
|
| 15 |
-
from smolagents import CodeAgent,
|
| 16 |
|
| 17 |
# -------------------------
|
| 18 |
# Minimal tools
|
|
@@ -80,19 +79,16 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 80 |
# -------------------------
|
| 81 |
prompt_templates = None
|
| 82 |
try:
|
|
|
|
| 83 |
with open("prompts.yaml", "r") as fh:
|
| 84 |
prompt_templates = yaml.safe_load(fh)
|
| 85 |
except Exception:
|
| 86 |
prompt_templates = None
|
| 87 |
|
| 88 |
# -------------------------
|
| 89 |
-
#
|
| 90 |
# -------------------------
|
| 91 |
-
model =
|
| 92 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 93 |
-
max_tokens=1024,
|
| 94 |
-
temperature=0.0
|
| 95 |
-
)
|
| 96 |
|
| 97 |
code_agent = CodeAgent(
|
| 98 |
model=model,
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
|
| 3 |
import os
|
|
|
|
| 4 |
import ast
|
| 5 |
import operator
|
| 6 |
import datetime
|
| 7 |
import pytz
|
| 8 |
import json
|
| 9 |
+
import re
|
| 10 |
import requests
|
|
|
|
| 11 |
import pandas as pd
|
| 12 |
import gradio as gr
|
| 13 |
|
| 14 |
+
from smolagents import CodeAgent, TransformersModel, tool
|
| 15 |
|
| 16 |
# -------------------------
|
| 17 |
# Minimal tools
|
|
|
|
| 79 |
# -------------------------
|
| 80 |
prompt_templates = None
|
| 81 |
try:
|
| 82 |
+
import yaml
|
| 83 |
with open("prompts.yaml", "r") as fh:
|
| 84 |
prompt_templates = yaml.safe_load(fh)
|
| 85 |
except Exception:
|
| 86 |
prompt_templates = None
|
| 87 |
|
| 88 |
# -------------------------
|
| 89 |
+
# TransformersModel + CodeAgent minimal
|
| 90 |
# -------------------------
|
| 91 |
+
model = TransformersModel(model_id="HuggingFaceTB/SmolLM-135M-Instruct")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
code_agent = CodeAgent(
|
| 94 |
model=model,
|