Spaces:
Runtime error
Runtime error
File size: 700 Bytes
54e8483 84b4e3d 54e8483 84b4e3d 54e8483 84b4e3d b503163 3b69718 84b4e3d 4c23181 b503163 84b4e3d 3b69718 2a369c5 eefed22 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
from transformers import pipeline
# Load the NL2SQL model
model_id = "hrshtsharma2012/NL2SQL-Picard-final"
nl2sql = pipeline("text2text-generation", model=model_id)
def generate_sql(nl_query):
# Generate the SQL query from the natural language input
sql_query = nl2sql(nl_query)[0]["generated_text"]
return sql_query
# Create the Gradio interface
interface = gr.Interface(
fn=generate_sql,
inputs=gr.Textbox(label="Natural Language Query"),
outputs=gr.Textbox(label="SQL Query"),
title="NL to SQL Converter",
description="Enter a natural language query and get the corresponding SQL query.",
)
if __name__ == "__main__":
interface.launch()
|