text2sql-demo / app.py
Sarveshyadav19's picture
Update app.py
59a7833 verified
raw
history blame contribute delete
484 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline(
"text-generation",
model="Sarveshyadav19/text2sql-qwen-clean",
device_map=None
)
def generate_sql(question):
prompt = f"""
Question:
{question}
SQL:
"""
result = pipe(
prompt,
max_new_tokens=100
)
return result[0]["generated_text"]
demo = gr.Interface(
fn=generate_sql,
inputs="text",
outputs="text",
title="Text to SQL Generator"
)
demo.launch()