gpt-2 / app.py
abidlabs's picture
abidlabs HF staff
Update app.py
b60a13a
raw
history blame
377 Bytes
from transformers import pipeline
import gradio as gr
# First define a prediction function that takes in a text prompt and returns the text completion
model = pipeline('text-generation')
def predict(prompt):
completion = model(prompt)[0]['generated_text']
return completion
# Now create the interface
gr.Interface(fn=predict, inputs="text", outputs="text").launch()