andrewgleave commited on
Commit
4527dbf
1 Parent(s): cfb3ccc

Update model

Browse files
Files changed (1) hide show
  1. app.py +6 -9
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, AutoTokenizer, AutoModelForTokenClassification
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("ner", model=model, tokenizer=tokenizer, aggregation_strategy="simple")
 
 
 
 
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):