Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,8 @@ spider_dataset = load_dataset("spider", split='train[:5]')
|
|
14 |
|
15 |
def generate_sql(query):
|
16 |
results = nl2sql_pipeline(query)
|
17 |
-
|
|
|
18 |
return sql_query
|
19 |
|
20 |
# Use examples from the Spider dataset
|
@@ -32,4 +33,4 @@ interface = gr.Interface(
|
|
32 |
|
33 |
# Launch the app
|
34 |
if __name__ == "__main__":
|
35 |
-
interface.launch()
|
|
|
14 |
|
15 |
def generate_sql(query):
|
16 |
results = nl2sql_pipeline(query)
|
17 |
+
# Ensure that we get the first generated text as the SQL query
|
18 |
+
sql_query = results[0]['generated_text'] if results else "No SQL query generated"
|
19 |
return sql_query
|
20 |
|
21 |
# Use examples from the Spider dataset
|
|
|
33 |
|
34 |
# Launch the app
|
35 |
if __name__ == "__main__":
|
36 |
+
interface.launch()
|