File size: 279 Bytes
7858013
 
 
cddf551
7858013
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import gradio as gr
from transformers import pipeline

pipe = pipeline("text-generation", model="gpt2")

def predict(prompt):
    completion = model(prompt)[0]["generated_text"]
    return completion

iface = gr.Interface(fn=predict, inputs="text", outputs="text")
iface.launch()