Spaces:
Running
Running
| import gradio as gr | |
| from transformers import pipeline | |
| pipe = pipeline( | |
| "text-generation", | |
| model="Sarveshyadav19/text2sql-qwen-v3" | |
| ) | |
| def generate_sql(question): | |
| prompt = f""" | |
| ### Question: | |
| {question} | |
| ### SQL: | |
| """ | |
| result = pipe( | |
| prompt, | |
| max_new_tokens=100, | |
| do_sample=False | |
| ) | |
| return result[0]["generated_text"] | |
| demo = gr.Interface( | |
| fn=generate_sql, | |
| inputs="text", | |
| outputs="text", | |
| title="Text to SQL Generator" | |
| ) | |
| demo.launch() |