File size: 1,251 Bytes
c1db962
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c72cf05
10b2302
c1db962
8e19b14
10b2302
 
 
 
 
c1db962
fbd530b
 
c1db962
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import gradio as gr

from ner import NER

examples = [
    [
        'scientist, university, city', 
        ('Dr. Paul Hammond, a renowned neurologist at'
        ' Johns Hopkins University, has recently published'
        ' a paper in the prestigious journal "Nature Neuroscience".' 
        ' His research focuses on a rare genetic mutation, found'
        ' in less than 0.01% of the population, that appears to'
        ' prevent the development of Alzheimer\'s disease.'
        ' Collaborating with researchers at the University'
        ' of California, San Francisco, the team is now working'
        ' to understand the mechanism by which this mutation'
        ' confers its protective effect.\n'
        'Funded by the National Institutes of Health, their'
        ' research could potentially open new avenues for'
        ' Alzheimer\'s treatment.')
    ],
]

ner = NER('knowledgator/UTC-DeBERTa-base-v2')

gradio_app = gr.Interface(
    ner.process,
    inputs = [
        'text', 
        gr.Textbox(placeholder="Enter sentence here..."), 
        gr.Number(value=0.0, label="threshold")
    ], 
    outputs = [gr.HighlightedText()],
    examples=examples,
    theme="huggingface",
)

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