HusnaManakkot commited on
Commit
2a369c5
Β·
verified Β·
1 Parent(s): 1f50b4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -13,7 +13,11 @@ nl2sql_pipeline = pipeline("text2text-generation", model=model, tokenizer=tokeni
13
  spider_dataset = load_dataset("spider", split='train[:5]')
14
 
15
  def generate_sql(query):
 
 
 
16
  results = nl2sql_pipeline(query)
 
17
  sql_query = results[0]['generated_text']
18
  return sql_query
19
 
@@ -31,5 +35,5 @@ interface = gr.Interface(
31
  )
32
 
33
  # Launch the app
34
- if __name__ == "__main__":
35
  interface.launch()
 
13
  spider_dataset = load_dataset("spider", split='train[:5]')
14
 
15
  def generate_sql(query):
16
+ # Ensure the query is a string
17
+ query = str(query)
18
+ # Run the pipeline
19
  results = nl2sql_pipeline(query)
20
+ # Extract the SQL query
21
  sql_query = results[0]['generated_text']
22
  return sql_query
23
 
 
35
  )
36
 
37
  # Launch the app
38
+ if __name__ == "__main__":
39
  interface.launch()