Spaces:
Running
Running
Update model
Browse files
app.py
CHANGED
@@ -4,14 +4,7 @@ from collections import defaultdict, Counter
|
|
4 |
import matplotlib.pyplot as plt
|
5 |
import gradio as gr
|
6 |
import pandas as pd
|
7 |
-
from transformers import pipeline
|
8 |
-
|
9 |
-
MODELS = ["d4data/biomedical-ner-all"]
|
10 |
-
|
11 |
-
current_model = MODELS[0]
|
12 |
-
|
13 |
-
tokenizer = AutoTokenizer.from_pretrained(current_model)
|
14 |
-
model = AutoModelForTokenClassification.from_pretrained(current_model)
|
15 |
|
16 |
plt.switch_backend("Agg")
|
17 |
|
@@ -20,7 +13,11 @@ with open("examples.json", "r") as f:
|
|
20 |
content = json.load(f)
|
21 |
examples = [f"{x['label']}: {x['text']}" for x in content]
|
22 |
|
23 |
-
pipe = pipeline(
|
|
|
|
|
|
|
|
|
24 |
|
25 |
|
26 |
def plot_to_figure(grouped):
|
|
|
4 |
import matplotlib.pyplot as plt
|
5 |
import gradio as gr
|
6 |
import pandas as pd
|
7 |
+
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
plt.switch_backend("Agg")
|
10 |
|
|
|
13 |
content = json.load(f)
|
14 |
examples = [f"{x['label']}: {x['text']}" for x in content]
|
15 |
|
16 |
+
pipe = pipeline(
|
17 |
+
"ner",
|
18 |
+
model="Clinical-AI-Apollo/Medical-NER",
|
19 |
+
aggregation_strategy="simple",
|
20 |
+
)
|
21 |
|
22 |
|
23 |
def plot_to_figure(grouped):
|