Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,13 +15,23 @@ def generate_sql(query):
|
|
15 |
sql_query = results[0]['generated_text']
|
16 |
return sql_query
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
# Create a Gradio interface
|
19 |
interface = gr.Interface(
|
20 |
fn=generate_sql,
|
21 |
inputs=gr.Textbox(lines=2, placeholder="Enter your natural language query here..."),
|
22 |
outputs="text",
|
|
|
23 |
title="NL to SQL with Picard",
|
24 |
-
description="This model converts natural language queries into SQL. It's based on the Spider dataset.
|
25 |
)
|
26 |
|
27 |
# Launch the app
|
|
|
15 |
sql_query = results[0]['generated_text']
|
16 |
return sql_query
|
17 |
|
18 |
+
# Example questions from the Spider dataset
|
19 |
+
example_questions = [
|
20 |
+
("How many heads of the departments are older than 56 ?",),
|
21 |
+
("List the name, born state and age of the heads of departments ordered by age.",),
|
22 |
+
("List the creation year, name and budget of each department.",),
|
23 |
+
("What are the maximum and minimum budget of the departments?",),
|
24 |
+
("In which year were most departments established?.",)
|
25 |
+
]
|
26 |
+
|
27 |
# Create a Gradio interface
|
28 |
interface = gr.Interface(
|
29 |
fn=generate_sql,
|
30 |
inputs=gr.Textbox(lines=2, placeholder="Enter your natural language query here..."),
|
31 |
outputs="text",
|
32 |
+
examples=example_questions,
|
33 |
title="NL to SQL with Picard",
|
34 |
+
description="This model converts natural language queries into SQL. It's based on the Spider dataset. Try one of the example questions or enter your own!"
|
35 |
)
|
36 |
|
37 |
# Launch the app
|