Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from sqlalchemy import create_engine, MetaData, Table, Column, String, Integer, Float, insert, text, inspect
|
| 3 |
from smolagents import tool, CodeAgent, InferenceClientModel
|
|
@@ -80,9 +81,13 @@ for table in ["receipts", "waiters"]:
|
|
| 80 |
sql_engine.description = updated_description
|
| 81 |
|
| 82 |
# --- Create the agent ---
|
|
|
|
| 83 |
agent = CodeAgent(
|
| 84 |
tools=[sql_engine],
|
| 85 |
-
model=InferenceClientModel(
|
|
|
|
|
|
|
|
|
|
| 86 |
)
|
| 87 |
|
| 88 |
# --- Define Gradio interface ---
|
|
|
|
| 1 |
+
import os
|
| 2 |
import gradio as gr
|
| 3 |
from sqlalchemy import create_engine, MetaData, Table, Column, String, Integer, Float, insert, text, inspect
|
| 4 |
from smolagents import tool, CodeAgent, InferenceClientModel
|
|
|
|
| 81 |
sql_engine.description = updated_description
|
| 82 |
|
| 83 |
# --- Create the agent ---
|
| 84 |
+
# Use the HF_TOKEN secret stored in the Space
|
| 85 |
agent = CodeAgent(
|
| 86 |
tools=[sql_engine],
|
| 87 |
+
model=InferenceClientModel(
|
| 88 |
+
"meta-llama/Meta-Llama-3-8B-Instruct",
|
| 89 |
+
api_key=os.environ.get("HF_TOKEN") # 👈 Use secret key
|
| 90 |
+
),
|
| 91 |
)
|
| 92 |
|
| 93 |
# --- Define Gradio interface ---
|