Spaces:
Sleeping
Sleeping
arithescientist
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -39,11 +39,12 @@ st.write(f"Valid columns: {valid_columns}")
|
|
39 |
|
40 |
# Function to generate SQL query using Hugging Face model
|
41 |
def generate_sql_query(question, table_name, columns):
|
42 |
-
# Simplified prompt to focus on generating valid SQL
|
43 |
prompt = f"""
|
44 |
-
You are a SQL expert. Generate a SQL query using the
|
45 |
{columns}.
|
46 |
Question: {question}
|
|
|
47 |
"""
|
48 |
response = llm(prompt, max_new_tokens=50, truncation=True) # Ensure max tokens are reasonable
|
49 |
return response[0]['generated_text'].strip()
|
|
|
39 |
|
40 |
# Function to generate SQL query using Hugging Face model
|
41 |
def generate_sql_query(question, table_name, columns):
|
42 |
+
# Simplified and direct prompt to focus on generating valid SQL
|
43 |
prompt = f"""
|
44 |
+
You are a SQL expert. Generate a SQL query using the columns:
|
45 |
{columns}.
|
46 |
Question: {question}
|
47 |
+
Respond only with the SQL query.
|
48 |
"""
|
49 |
response = llm(prompt, max_new_tokens=50, truncation=True) # Ensure max tokens are reasonable
|
50 |
return response[0]['generated_text'].strip()
|