Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -85,7 +85,7 @@ def text2sql(dataset_name, query_input):
|
|
85 |
### Question:
|
86 |
{query_input}
|
87 |
|
88 |
-
### Response (use duckdb shorthand if possible)
|
89 |
"""
|
90 |
try:
|
91 |
sql_output = query_remote_model(text)
|
@@ -98,7 +98,7 @@ def text2sql(dataset_name, query_input):
|
|
98 |
}
|
99 |
|
100 |
# Should be replaced by the prompt but not working
|
101 |
-
sql_output = sql_output.replace("data", f"'{first_parquet_url}'")
|
102 |
try:
|
103 |
query_result = con.sql(sql_output).df()
|
104 |
except Exception as error:
|
@@ -118,7 +118,7 @@ with gr.Blocks() as demo:
|
|
118 |
gr.Markdown("This space showcase how to generate a SQL query from a text and get the result.")
|
119 |
gr.Markdown("Tech stack: duckdb and DuckDB-NSQL-7B model")
|
120 |
dataset_name = gr.Textbox("jamescalam/world-cities-geo", label="Dataset Name")
|
121 |
-
query_input = gr.Textbox("
|
122 |
examples = [
|
123 |
["Cities from Albania country"],
|
124 |
["The continent with the most number of countries"],
|
|
|
85 |
### Question:
|
86 |
{query_input}
|
87 |
|
88 |
+
### Response (use duckdb shorthand if possible):
|
89 |
"""
|
90 |
try:
|
91 |
sql_output = query_remote_model(text)
|
|
|
98 |
}
|
99 |
|
100 |
# Should be replaced by the prompt but not working
|
101 |
+
sql_output = sql_output.replace("FROM data", f"FROM '{first_parquet_url}'")
|
102 |
try:
|
103 |
query_result = con.sql(sql_output).df()
|
104 |
except Exception as error:
|
|
|
118 |
gr.Markdown("This space showcase how to generate a SQL query from a text and get the result.")
|
119 |
gr.Markdown("Tech stack: duckdb and DuckDB-NSQL-7B model")
|
120 |
dataset_name = gr.Textbox("jamescalam/world-cities-geo", label="Dataset Name")
|
121 |
+
query_input = gr.Textbox("Cities from Albania country?", label="Ask something about your data")
|
122 |
examples = [
|
123 |
["Cities from Albania country"],
|
124 |
["The continent with the most number of countries"],
|