hssan98's picture
Create app.py
deb0e91 verified
raw
history blame contribute delete
500 Bytes
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "defog/sqlcoder-70b-alpha"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
def generate_sql(query):
inputs = tokenizer(query, return_tensors="pt")
outputs = model.generate(**inputs)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
iface = gr.Interface(fn=generate_sql, inputs="text", outputs="text")
iface.launch()