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()