age / app.py
farid678's picture
Update app.py
0b35cbd verified
raw
history blame
No virus
397 Bytes
from transformers import pipeline
import textwrap
import time
import gradio as gr
# Load a pre-trained chatbot model
chatbot = pipeline('text-generation', model='gpt2-large')
def wrap(x):
return textwrap.fill(x, replace_whitespace=False, fix_sentence_endings=True)
def chat(prompt):
return chatbot(prompt)[0]['generated_text']
gr.Interface(fn=chat, inputs="text", outputs="text").launch()