Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,8 +9,8 @@ model = AutoModelForSeq2SeqLM.from_pretrained("hrshtsharma2012/NL2SQL-Picard-fin
|
|
9 |
# Initialize the pipeline
|
10 |
nl2sql_pipeline = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
|
11 |
|
12 |
-
# Load a part of the
|
13 |
-
|
14 |
|
15 |
def generate_sql(query):
|
16 |
results = nl2sql_pipeline(query)
|
@@ -19,8 +19,8 @@ def generate_sql(query):
|
|
19 |
sql_query = sql_query.replace('<pad>', '').replace('</s>', '').strip()
|
20 |
return sql_query
|
21 |
|
22 |
-
# Use examples from the
|
23 |
-
example_questions = [(question['question'],) for question in
|
24 |
|
25 |
# Create a Gradio interface
|
26 |
interface = gr.Interface(
|
@@ -29,7 +29,7 @@ interface = gr.Interface(
|
|
29 |
outputs="text",
|
30 |
examples=example_questions,
|
31 |
title="NL to SQL with Picard",
|
32 |
-
description="This model converts natural language queries into SQL using the
|
33 |
)
|
34 |
|
35 |
# Launch the app
|
|
|
9 |
# Initialize the pipeline
|
10 |
nl2sql_pipeline = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
|
11 |
|
12 |
+
# Load a part of the WikiSQL dataset
|
13 |
+
wikisql_dataset = load_dataset("wikisql", split='train[:5]')
|
14 |
|
15 |
def generate_sql(query):
|
16 |
results = nl2sql_pipeline(query)
|
|
|
19 |
sql_query = sql_query.replace('<pad>', '').replace('</s>', '').strip()
|
20 |
return sql_query
|
21 |
|
22 |
+
# Use examples from the WikiSQL dataset
|
23 |
+
example_questions = [(question['question'],) for question in wikisql_dataset]
|
24 |
|
25 |
# Create a Gradio interface
|
26 |
interface = gr.Interface(
|
|
|
29 |
outputs="text",
|
30 |
examples=example_questions,
|
31 |
title="NL to SQL with Picard",
|
32 |
+
description="This model converts natural language queries into SQL using the WikiSQL dataset. Try one of the example questions or enter your own!"
|
33 |
)
|
34 |
|
35 |
# Launch the app
|