Spaces:
Sleeping
Sleeping
File size: 593 Bytes
8aa16cb 239f249 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
from transformers import pipeline
# Load model
sql_pipeline = pipeline("text2text-generation", model="suriya7/t5-base-text-to-sql")
# Define function (fixing the parameter issue)
def ask_sql(message, history=None):
prompt = f"translate to SQL: {message}"
output = sql_pipeline(prompt, max_length=128, do_sample=False)[0]['generated_text']
return output
# Create ChatInterface
gr.ChatInterface(
fn=ask_sql,
title="SQL Query Generator Bot",
description="Ask a question like 'How many students are in the class?' and get the SQL query.",
).launch()
|