File size: 589 Bytes
7e6964a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from website_script import load, run

print("Loading model")
tokenizer, model, gazetteers_for_matching = load()
print("Loaded model")

examples = [
    "Masarykova univerzita",
]

def ner(text):
    result = run(tokenizer, model, gazetteers_for_matching, text)
    return result

demo = gr.Interface(ner,
             gr.Textbox(placeholder="Enter sentence here..."), 
             "textbox",
             #gr.HighlightedText(), # TODO https://www.gradio.app/guides/named-entity-recognition
             examples=examples)

if __name__ == "__main__":
    demo.launch()