asoria HF staff commited on
Commit
c824141
·
verified ·
1 Parent(s): 639f8ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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) replace all table names with {first_parquet_url} in the generated sql query:
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("Which cities are part of Albania country?", label="Ask something about your data")
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"],