File size: 328 Bytes
b4fa516
b51360a
 
b4fa516
 
b51360a
b4fa516
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from transformers import pipeline
import gradio as gr

#define the model
model = pipeline("text-generation")

#define the predict function
def predict(prompt):
    completion = model(prompt)[0]["generated_text"]
    return completion

#define the gradio interface
gr.Interface(fn=predict, inputs="text", outputs="text").launch()