HusnaManakkot commited on
Commit
d82d943
Β·
verified Β·
1 Parent(s): f525ef3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
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 Spider dataset
13
- spider_dataset = load_dataset("spider", split='train[:5]')
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 Spider dataset
23
- example_questions = [(question['question'],) for question in spider_dataset]
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 Spider dataset. Try one of the example questions or enter your own!"
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