Spaces:
Runtime error
Runtime error
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() | |