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