Spaces:
Sleeping
Sleeping
add support for persisted db
Browse files
app.py
CHANGED
@@ -1,20 +1,12 @@
|
|
1 |
import os
|
2 |
-
# from dotenv import load_dotenv
|
3 |
import gradio as gr
|
4 |
from sqlalchemy import text
|
5 |
from smolagents import tool, CodeAgent, HfApiModel
|
6 |
import spaces
|
7 |
|
8 |
-
# Import database
|
9 |
from database import engine, receipts
|
10 |
|
11 |
-
# Load Hugging Face API token
|
12 |
-
# load_dotenv(override=True)
|
13 |
-
# hf_token = os.getenv("HF_TOKEN")
|
14 |
-
|
15 |
-
# if not hf_token:
|
16 |
-
# raise ValueError("HF_TOKEN environment variable is not set.")
|
17 |
-
|
18 |
@tool
|
19 |
def sql_engine(query: str) -> str:
|
20 |
"""
|
@@ -25,7 +17,6 @@ def sql_engine(query: str) -> str:
|
|
25 |
- customer_name: VARCHAR(16)
|
26 |
- price: FLOAT
|
27 |
- tip: FLOAT
|
28 |
-
|
29 |
Args:
|
30 |
query: The SQL query to execute.
|
31 |
|
|
|
1 |
import os
|
|
|
2 |
import gradio as gr
|
3 |
from sqlalchemy import text
|
4 |
from smolagents import tool, CodeAgent, HfApiModel
|
5 |
import spaces
|
6 |
|
7 |
+
# Import the persistent database
|
8 |
from database import engine, receipts
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
@tool
|
11 |
def sql_engine(query: str) -> str:
|
12 |
"""
|
|
|
17 |
- customer_name: VARCHAR(16)
|
18 |
- price: FLOAT
|
19 |
- tip: FLOAT
|
|
|
20 |
Args:
|
21 |
query: The SQL query to execute.
|
22 |
|