Changing model to Named Entity Recognition
Browse files
app.py
CHANGED
@@ -2,9 +2,9 @@ import gradio as gr
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
def generate_story(story):
|
5 |
-
story_gen = pipeline("
|
6 |
story_expanded = story_gen(story)
|
7 |
-
return story_expanded
|
8 |
|
9 |
demo = gr.Interface (
|
10 |
fn=generate_story,
|
@@ -12,8 +12,8 @@ demo = gr.Interface (
|
|
12 |
examples=[
|
13 |
["Adventurer is approached by a mysterious stranger in the tavern for a new quest."],
|
14 |
["He didn't remember the last time he had to run this fast as he jumped on to the bus."],
|
15 |
-
["Fate has it's own plans for the common man, which is why we philosophise on "],
|
16 |
-
["The bear reached the river and spotted a school of fish. His hunger started taking its toll"]
|
17 |
],
|
18 |
inputs=[gr.Textbox(lines=7, label="Story URL")],
|
19 |
outputs=[gr.Textbox(lines=7, label="Story Summary")]
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
def generate_story(story):
|
5 |
+
story_gen = pipeline("ner", "dbmdz/bert-large-cased-finetuned-conll03-english", grouped_entities=True)
|
6 |
story_expanded = story_gen(story)
|
7 |
+
return str(story_expanded)
|
8 |
|
9 |
demo = gr.Interface (
|
10 |
fn=generate_story,
|
|
|
12 |
examples=[
|
13 |
["Adventurer is approached by a mysterious stranger in the tavern for a new quest."],
|
14 |
["He didn't remember the last time he had to run this fast as he jumped on to the bus."],
|
15 |
+
["Fate has it's own plans for the common man, which is why we philosophise on the observationg giving it our own interpretation."],
|
16 |
+
["The bear reached the river and spotted a school of fish. His hunger started taking its toll."]
|
17 |
],
|
18 |
inputs=[gr.Textbox(lines=7, label="Story URL")],
|
19 |
outputs=[gr.Textbox(lines=7, label="Story Summary")]
|