import transformers | |
from transformers import pipeline | |
import gradio as gr | |
model = pipeline("text-generation", model="gpt2", tokenizer="gpt2") | |
def generate_text(input_text): | |
return model(input_text)[0]['generated_text'] | |
iface = gr.Interface(fn=generate_text, inputs="text", outputs="text") | |
iface.launch(share=True) | |