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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -13,10 +13,10 @@ 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
- # 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
 
13
  spider_dataset = load_dataset("spider", split='train[:5]')
14
 
15
  def generate_sql(query):
16
+ # Format the input for the model
17
+ input_text = f"translate English to SQL: {query}"
18
  # Run the pipeline
19
+ results = nl2sql_pipeline(input_text)
20
  # Extract the SQL query
21
  sql_query = results[0]['generated_text']
22
  return sql_query