derbynames / app.py
bdunnette's picture
Update app.py
e39885f
raw
history blame contribute delete
516 Bytes
import gradio as gr
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
tokenizer = AutoTokenizer.from_pretrained("bdunnette/derbynames-aitextgen")
model = AutoModelForCausalLM.from_pretrained("bdunnette/derbynames-aitextgen")
generator = pipeline(task="text-generation", model=model, tokenizer=tokenizer)
def greet(name):
generated = generator(name)[0]['generated_text']
print(generated)
return generated
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()