asoria HF staff commited on
Commit
47f2421
·
verified ·
1 Parent(s): e543e92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -14
app.py CHANGED
@@ -101,22 +101,28 @@ def text2sql(dataset_name, query_input):
101
 
102
 
103
  with gr.Blocks() as demo:
 
104
  gr.Markdown("# Generate SQL queries based on a given text for your dataset")
105
  gr.Markdown("This space showcase how to generate a SQL query from a text and get the result.")
106
  gr.Markdown("Tech stack: duckdb and DuckDB-NSQL-7B model")
107
- dataset_name = gr.Textbox("jamescalam/world-cities-geo", label="Dataset Name")
108
- query_input = gr.Textbox("Cities from Albania country", label="Ask something about your data")
109
- examples = [
110
- ["Cities from Albania country"],
111
- ["The continent with the most number of countries"],
112
- ["Cities that start with 'A'"],
113
- ["Cities by region"],
114
- ]
115
- gr.Examples(examples=examples, inputs=[query_input],outputs=[])
116
- btn = gr.Button("Generate SQL")
117
- schema_output = gr.Textbox(label="Parquet Schema as CREATE DDL", interactive= False)
118
- prompt_output = gr.Textbox(label="Generated prompt", interactive= False)
119
- query_output = gr.Textbox(label="Output SQL", interactive= False)
120
- df = gr.DataFrame(datatype="markdown")
 
 
 
 
 
121
  btn.click(text2sql, inputs=[dataset_name, query_input], outputs=[schema_output, prompt_output, query_output,df])
122
  demo.launch(debug=True)
 
101
 
102
 
103
  with gr.Blocks() as demo:
104
+ with gr.Row():
105
  gr.Markdown("# Generate SQL queries based on a given text for your dataset")
106
  gr.Markdown("This space showcase how to generate a SQL query from a text and get the result.")
107
  gr.Markdown("Tech stack: duckdb and DuckDB-NSQL-7B model")
108
+ with gr.Row():
109
+ with gr.Column(scale=1, min_width=600):
110
+ dataset_name = gr.Textbox("jamescalam/world-cities-geo", label="Dataset Name")
111
+ query_input = gr.Textbox("Cities from Albania country", label="Ask something about your data")
112
+ examples = [
113
+ ["Cities from Albania country"],
114
+ ["The continent with the most number of countries"],
115
+ ["Cities that start with 'A'"],
116
+ ["Cities by region"],
117
+ ]
118
+ gr.Examples(examples=examples, inputs=[query_input],outputs=[])
119
+ btn = gr.Button("Generate SQL")
120
+ with gr.Row():
121
+ with gr.Column(scale=1, min_width=600):
122
+ schema_output = gr.Textbox(label="Parquet Schema as CREATE DDL", interactive= False)
123
+ prompt_output = gr.Textbox(label="Generated prompt", interactive= False)
124
+ with gr.Column(scale=1, min_width=600):
125
+ query_output = gr.Textbox(label="Output SQL", interactive= False)
126
+ df = gr.DataFrame(datatype="markdown")
127
  btn.click(text2sql, inputs=[dataset_name, query_input], outputs=[schema_output, prompt_output, query_output,df])
128
  demo.launch(debug=True)