HusnaManakkot commited on
Commit
5549b24
Β·
verified Β·
1 Parent(s): 4dbafc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -11,9 +11,9 @@ def generate_sql(query):
11
  outputs = model.generate(**inputs, max_length=512)
12
  sql_query = tokenizer.decode(outputs[0], skip_special_tokens=True)
13
 
14
- # Check if the output is the same as the input
15
- if sql_query.strip().lower() == query.strip().lower():
16
- return "The model did not generate a SQL query. Please try a different input or use a different model."
17
 
18
  return sql_query
19
 
 
11
  outputs = model.generate(**inputs, max_length=512)
12
  sql_query = tokenizer.decode(outputs[0], skip_special_tokens=True)
13
 
14
+ # Check if the output is a valid SQL query
15
+ if not sql_query.lower().startswith("select"):
16
+ return "The model did not generate a valid SQL query. Please try a different input or use a different model."
17
 
18
  return sql_query
19