themissingCRAM
commited on
Commit
·
8586ebb
1
Parent(s):
5992538
gradio requirement.txt'
Browse files- app.py +12 -13
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -1,12 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
import os
|
| 4 |
-
from smolagents import tool, CodeAgent, HfApiModel, GradioUI
|
| 5 |
|
| 6 |
-
# testing teste
|
| 7 |
-
"""
|
| 8 |
-
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 9 |
-
"""
|
| 10 |
client = InferenceClient(
|
| 11 |
"HuggingFaceH4/zephyr-7b-beta", token=os.getenv("my_first_agents_hf_tokens")
|
| 12 |
)
|
|
@@ -34,14 +30,7 @@ def sql_engine(query: str) -> str:
|
|
| 34 |
return output
|
| 35 |
|
| 36 |
|
| 37 |
-
|
| 38 |
-
agent = CodeAgent(
|
| 39 |
-
tools=[sql_engine],
|
| 40 |
-
model=HfApiModel(
|
| 41 |
-
model_id="meta-llama/Meta-Llama-3.1-8B-Instruct",
|
| 42 |
-
token=os.getenv("my_first_agents_hf_tokens"),
|
| 43 |
-
),
|
| 44 |
-
)
|
| 45 |
|
| 46 |
from sqlalchemy import (
|
| 47 |
create_engine,
|
|
@@ -93,4 +82,14 @@ if __name__ == "__main__":
|
|
| 93 |
},
|
| 94 |
]
|
| 95 |
insert_rows_into_table(rows, receipts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
GradioUI(agent).launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
import os
|
| 4 |
+
from smolagents import tool, CodeAgent, HfApiModel, GradioUI
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
client = InferenceClient(
|
| 7 |
"HuggingFaceH4/zephyr-7b-beta", token=os.getenv("my_first_agents_hf_tokens")
|
| 8 |
)
|
|
|
|
| 30 |
return output
|
| 31 |
|
| 32 |
|
| 33 |
+
def init_db():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
from sqlalchemy import (
|
| 36 |
create_engine,
|
|
|
|
| 82 |
},
|
| 83 |
]
|
| 84 |
insert_rows_into_table(rows, receipts)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
if __name__ == "__main__":
|
| 88 |
+
agent = CodeAgent(
|
| 89 |
+
tools=[sql_engine],
|
| 90 |
+
model=HfApiModel(
|
| 91 |
+
model_id="meta-llama/Meta-Llama-3.1-8B-Instruct",
|
| 92 |
+
token=os.getenv("my_first_agents_hf_tokens"),
|
| 93 |
+
),
|
| 94 |
+
)
|
| 95 |
GradioUI(agent).launch()
|
requirements.txt
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
huggingface_hub>=0.28.0
|
| 2 |
smolagents==1.12.0
|
| 3 |
python-dotenv==1.1.0
|
| 4 |
-
sqlalchemy==2.0.40
|
|
|
|
|
|
| 1 |
huggingface_hub>=0.28.0
|
| 2 |
smolagents==1.12.0
|
| 3 |
python-dotenv==1.1.0
|
| 4 |
+
sqlalchemy==2.0.40
|
| 5 |
+
gradio>0.0.0
|