note-ner-demo / app.py
andrewgleave's picture
WIP
8f3ee0f
raw
history blame
483 Bytes
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()