asoria HF staff commited on
Commit
d34f941
·
verified ·
1 Parent(s): 457910c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -97,6 +97,7 @@ def text2sql(dataset_name, query_input):
97
  df:pd.DataFrame([{"error": f"❌ Unable to get the SQL query based on the text. {error=}"}])
98
  }
99
 
 
100
  sql_output = sql_output.replace("data", f"'{first_parquet_url}'")
101
  try:
102
  query_result = con.sql(sql_output).df()
@@ -118,6 +119,13 @@ with gr.Blocks() as demo:
118
  gr.Markdown("Tech stack: duckdb and DuckDB-NSQL-7B model")
119
  dataset_name = gr.Textbox("jamescalam/world-cities-geo", label="Dataset Name")
120
  query_input = gr.Textbox("Which cities are part of Albania country?", label="Ask something about your data")
 
 
 
 
 
 
 
121
  btn = gr.Button("Generate SQL")
122
  schema_output = gr.Textbox(label="Parquet Schema as CREATE DDL", interactive= False)
123
  prompt_output = gr.Textbox(label="Generated prompt", interactive= False)
 
97
  df:pd.DataFrame([{"error": f"❌ Unable to get the SQL query based on the text. {error=}"}])
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()
 
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"],
125
+ ["Cities that start with 'A'"],
126
+ ["Cities by region"],
127
+ ]
128
+ gr.examples(examples=examples, output=query_input)
129
  btn = gr.Button("Generate SQL")
130
  schema_output = gr.Textbox(label="Parquet Schema as CREATE DDL", interactive= False)
131
  prompt_output = gr.Textbox(label="Generated prompt", interactive= False)