themissingCRAM
commited on
Commit
·
f1aaba3
1
Parent(s):
ffb403f
model change
Browse files
app.py
CHANGED
@@ -2,6 +2,20 @@ import gradio as gr
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import os
|
4 |
from smolagents import tool, CodeAgent, HfApiModel, GradioUI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
|
7 |
@tool
|
@@ -28,20 +42,6 @@ def sql_engine(query: str) -> str:
|
|
28 |
|
29 |
def init_db():
|
30 |
|
31 |
-
from sqlalchemy import (
|
32 |
-
create_engine,
|
33 |
-
MetaData,
|
34 |
-
Table,
|
35 |
-
Column,
|
36 |
-
String,
|
37 |
-
Integer,
|
38 |
-
Float,
|
39 |
-
insert,
|
40 |
-
inspect,
|
41 |
-
text,
|
42 |
-
)
|
43 |
-
|
44 |
-
engine = create_engine("sqlite:///:memory:")
|
45 |
metadata_obj = MetaData()
|
46 |
|
47 |
def insert_rows_into_table(rows, table, engine=engine):
|
@@ -81,10 +81,11 @@ def init_db():
|
|
81 |
|
82 |
|
83 |
if __name__ == "__main__":
|
|
|
84 |
agent = CodeAgent(
|
85 |
tools=[sql_engine],
|
86 |
model=HfApiModel(
|
87 |
-
model_id="
|
88 |
token=os.getenv("my_first_agents_hf_tokens"),
|
89 |
),
|
90 |
)
|
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import os
|
4 |
from smolagents import tool, CodeAgent, HfApiModel, GradioUI
|
5 |
+
from sqlalchemy import (
|
6 |
+
create_engine,
|
7 |
+
MetaData,
|
8 |
+
Table,
|
9 |
+
Column,
|
10 |
+
String,
|
11 |
+
Integer,
|
12 |
+
Float,
|
13 |
+
insert,
|
14 |
+
inspect,
|
15 |
+
text,
|
16 |
+
)
|
17 |
+
|
18 |
+
engine = create_engine("sqlite:///:memory:")
|
19 |
|
20 |
|
21 |
@tool
|
|
|
42 |
|
43 |
def init_db():
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
metadata_obj = MetaData()
|
46 |
|
47 |
def insert_rows_into_table(rows, table, engine=engine):
|
|
|
81 |
|
82 |
|
83 |
if __name__ == "__main__":
|
84 |
+
init_db()
|
85 |
agent = CodeAgent(
|
86 |
tools=[sql_engine],
|
87 |
model=HfApiModel(
|
88 |
+
model_id="HuggingFaceTB/SmolLM2-1.7B-Instruct",
|
89 |
token=os.getenv("my_first_agents_hf_tokens"),
|
90 |
),
|
91 |
)
|