File size: 940 Bytes
a970736
e91e0ec
5a65659
c805802
d82f17d
c805802
d82f17d
5a65659
 
c805802
619e8b5
83c780e
ac59da8
 
d82f17d
 
83c780e
5a65659
 
1cfb225
5a65659
619e8b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from transformers import pipeline

def generate_story(story):
    story_gen = pipeline("ner", "dbmdz/bert-large-cased-finetuned-conll03-english", grouped_entities=True)
    story_expanded = story_gen(story)
    return str(story_expanded)

demo = gr.Interface (
    fn=generate_story,
    description="Story generation with GPT-2",
    examples=[
        ["Adventurer is approached by a mysterious stranger in the tavern for a new quest."],
        ["He didn't remember the last time he had to run this fast as he jumped on to the bus."],
        ["Fate has it's own plans for the common man, which is why we philosophise on the observationg giving it our own interpretation."],
        ["The bear reached the river and spotted a school of fish. His hunger started taking its toll."]
    ],
	inputs=[gr.Textbox(lines=7, label="Story URL")],
	outputs=[gr.Textbox(lines=7, label="Story Summary")]
)

demo.launch(share=True)