Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -101,29 +101,22 @@ def text2sql(dataset_name, query_input):
|
|
101 |
|
102 |
|
103 |
with gr.Blocks() as demo:
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
with gr.Column(scale=1, min_width=600):
|
109 |
-
dataset_name = gr.Textbox("jamescalam/world-cities-geo", label="Dataset Name")
|
110 |
-
query_input = gr.Textbox("Cities from Albania country", label="Ask something about your data")
|
111 |
-
examples = [
|
112 |
["Cities from Albania country"],
|
113 |
["The continent with the most number of countries"],
|
114 |
["Cities that start with 'A'"],
|
115 |
["Cities by region"],
|
116 |
]
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
#with gr.Column(scale=1, min_width=600):
|
123 |
-
|
124 |
-
|
125 |
-
with gr.Column(scale=1, min_width=600):
|
126 |
-
query_output = gr.Textbox(label="Output SQL", interactive= False)
|
127 |
-
df = gr.DataFrame(datatype="markdown")
|
128 |
btn.click(text2sql, inputs=[dataset_name, query_input], outputs=[schema_output, prompt_output, query_output,df])
|
129 |
demo.launch(debug=True)
|
|
|
101 |
|
102 |
|
103 |
with gr.Blocks() as demo:
|
104 |
+
gr.Markdown("# π« Generate SQL queries based on a given text for your Hugging Face Dataset π«")
|
105 |
+
dataset_name = gr.Textbox("jamescalam/world-cities-geo", label="Dataset Name")
|
106 |
+
query_input = gr.Textbox("Cities from Albania country", label="Ask something about your data")
|
107 |
+
examples = [
|
|
|
|
|
|
|
|
|
108 |
["Cities from Albania country"],
|
109 |
["The continent with the most number of countries"],
|
110 |
["Cities that start with 'A'"],
|
111 |
["Cities by region"],
|
112 |
]
|
113 |
+
gr.Examples(examples=examples, inputs=[query_input],outputs=[])
|
114 |
+
btn = gr.Button("Generate SQL")
|
115 |
+
query_output = gr.Textbox(label="Output SQL", interactive= False)
|
116 |
+
df = gr.DataFrame(datatype="markdown")
|
117 |
+
with gr.Accordion("Open for prompt details", open=False):
|
118 |
#with gr.Column(scale=1, min_width=600):
|
119 |
+
schema_output = gr.Textbox(label="Parquet Schema as CREATE DDL", interactive= False)
|
120 |
+
prompt_output = gr.Textbox(label="Generated prompt", interactive= False)
|
|
|
|
|
|
|
121 |
btn.click(text2sql, inputs=[dataset_name, query_input], outputs=[schema_output, prompt_output, query_output,df])
|
122 |
demo.launch(debug=True)
|