File size: 613 Bytes
a970736
084b57b
ba5952d
 
 
 
1cfb225
 
 
 
 
 
 
 
a970736
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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("<BOS> <superhero> 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=[gr.inputs.Textbox(label='News Summary Output')]
)
interface.launch()