File size: 483 Bytes
bdf7636
 
 
 
 
 
 
58c1264
 
bdf7636
 
 
 
 
 
 
 
 
 
 
8f3ee0f
bdf7636
 
 
 
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
import json

import gradio as gr


def ner(text):
    api = gr.Interface.load("d4data/biomedical-ner-all", src="models")
    result = api(text)
    return result


EXAMPLE_TEXTS = []
with open("examples.json", "r") as f:
    example_json = json.load(f)
    EXAMPLE_TEXTS = [x["text"] for x in example_json]


interface = gr.Interface(
    ner,
    inputs=gr.Textbox(label="Input", value=""),
    outputs=["highlightedtext", "json"],
    examples=EXAMPLE_TEXTS,
)

interface.launch()