gpt2 / app.py
mohd43's picture
Create app.py
72ffc90 verified
raw
history blame contribute delete
417 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("text-generation", model="gpt2")
# a function that uses the pipeline
# takes text as input and passes it to the pipeline
def chat(text):
output = pipe(text)[0]["generated_text"]
return output
# fucntion , input of type text , output of type text
demo = gr.Interface(chat , "text" , "text" )
demo.launch()