getrajeev03/text2sql
2
1import gradio as gr2from transformers import AutoTokenizer, AutoModelWithLMHead3 4tokenizer = AutoTokenizer.from_pretrained("dbernsohn/t5_wikisql_en2SQL")5model = AutoModelWithLMHead.from_pretrained("dbernsohn/t5_wikisql_en2SQL")6 7def greet(query):8 input_text = f"translate English to Sql: {query} </s>"9 features = tokenizer([input_text], return_tensors='pt')10 output = model.generate(input_ids=features['input_ids'], 11 attention_mask=features['attention_mask'])12 return tokenizer.decode(output[0])13 14iface = gr.Interface(fn=greet, inputs="text", outputs="text", examples=[15 "what are the names of all the people in the USA"16])17iface.launch()