CoolFace
Apppublic

Mvelo/rlTrain

sourceHugging Facemitupdated 3y agoView on Hugging Face
0likes
app.py17 linesDownload Raw Back to root
1import gradio as gr2 3import gradio as gr4from transformers import GPT2Tokenizer, GPT2Model5tokenizer = GPT2Tokenizer.from_pretrained('gpt2-xl')6model = GPT2Model.from_pretrained('gpt2-xl')7text = "Replace me by any text you'd like."8encoded_input = tokenizer(text, return_tensors='pt')9output = model(**encoded_input)10 11 12# Create a Gradio interface with text input and text output13iface = gr.Interface(fn=generate_text, inputs="text", outputs="text", title="Text Generation")14iface.launch()15 16 17