Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
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)
|