Chriz94's picture
Update app.py
6d6b1b8
raw
history blame contribute delete
966 Bytes
import gradio as gr
from transformers import pipeline, GPT2Config
config_dict = {'max_length':200}
config = GPT2Config.from_dict(config_dict)
pipe = pipeline('text-generation', model='Chriz94/gpt2_HubermanPodcast', config=config)
def generate_text(prompt):
generated = pipe(prompt, max_length=200)[0]['generated_text']
return generated
iface = gr.Interface(
fn=generate_text,
inputs="textbox",
outputs="text",
title="GPT-2 Text Generation",
description="Generate text using the GPT-2 model.",
article="""This is a GPT2 model that has been finetuned on 50 transcripts from Huberman Lab Podcast. This interface will allow you to play around with some text generation from prompts. The model was only trained for 20 epochs, and so the outputs it produces are still relatively nonsensical.""",
examples=[
["Sleep"],
["Caffeine"],
['Circadian rythm'],
],
)
if __name__ == '__main__':
iface.launch()