import gradio as gr from transformers import pipeline def generate_story(story): story_gen = pipeline("text-generation", "pranavpsv/gpt2-genre-story-generator") generated_story = story_gen(" Batman") return generated_story interface = gr.Interface(fn=generate_story, title="Story Generation with GPT-2", inputs=[gr.Textbox(lines=7, label="Story")], description="Story generation with GPT-2", examples=[["Adventurer is approached by a mysterious stranger in the tavern for a new quest"]], outputs="label") interface.launch()