Spaces:
Runtime error
Runtime error
Mustehson
commited on
Commit
Β·
aad99a8
1
Parent(s):
e2762c5
Added Langsmith
Browse files- app.py +8 -1
- requirements.txt +5 -4
app.py
CHANGED
@@ -4,7 +4,7 @@ import gradio as gr
|
|
4 |
import matplotlib.pyplot as plt
|
5 |
from transformers import HfEngine, ReactCodeAgent
|
6 |
from transformers.agents import Tool
|
7 |
-
|
8 |
# Height of the Tabs Text Area
|
9 |
TAB_LINES = 8
|
10 |
# Load Token
|
@@ -146,6 +146,11 @@ def get_visualization(question, tool, schema, table_name):
|
|
146 |
return results
|
147 |
|
148 |
|
|
|
|
|
|
|
|
|
|
|
149 |
class SQLExecutorTool(Tool):
|
150 |
name = "sql_engine"
|
151 |
inputs = {
|
@@ -176,6 +181,8 @@ def main(table, text_query):
|
|
176 |
fig = output.get('fig', None)
|
177 |
generated_sql = output.get('sql', None)
|
178 |
data = output.get('data', None)
|
|
|
|
|
179 |
except Exception as e:
|
180 |
gr.Warning(f"β Unable to generate the visualization. {e}")
|
181 |
|
|
|
4 |
import matplotlib.pyplot as plt
|
5 |
from transformers import HfEngine, ReactCodeAgent
|
6 |
from transformers.agents import Tool
|
7 |
+
from langsmith import traceable
|
8 |
# Height of the Tabs Text Area
|
9 |
TAB_LINES = 8
|
10 |
# Load Token
|
|
|
146 |
return results
|
147 |
|
148 |
|
149 |
+
@traceable()
|
150 |
+
def query_response(input_prompt, generated_sql):
|
151 |
+
return generated_sql
|
152 |
+
|
153 |
+
|
154 |
class SQLExecutorTool(Tool):
|
155 |
name = "sql_engine"
|
156 |
inputs = {
|
|
|
181 |
fig = output.get('fig', None)
|
182 |
generated_sql = output.get('sql', None)
|
183 |
data = output.get('data', None)
|
184 |
+
input_prompt = text_query + '\n' + table_name + '\n' + schema
|
185 |
+
_ = query_response(input_prompt, generated_sql)
|
186 |
except Exception as e:
|
187 |
gr.Warning(f"β Unable to generate the visualization. {e}")
|
188 |
|
requirements.txt
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
torch
|
2 |
-
huggingface_hub
|
3 |
-
accelerate
|
4 |
-
transformers==4.44.2
|
5 |
-
duckdb
|
6 |
seaborn
|
7 |
plotly
|
|
|
|
|
|
|
|
|
|
|
|
1 |
torch
|
|
|
|
|
|
|
|
|
2 |
seaborn
|
3 |
plotly
|
4 |
+
huggingface_hub
|
5 |
+
accelerate==0.34.2
|
6 |
+
transformers==4.44.2
|
7 |
+
duckdb==1.1.1
|
8 |
+
langsmith==0.1.135
|