File size: 336 Bytes
be9e49a
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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)