hassoudi commited on
Commit
78cec5b
·
verified ·
1 Parent(s): f17afad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -2,6 +2,10 @@ import gradio as gr
2
  from transformers import pipeline
3
  import os
4
 
 
 
 
 
5
  # Initialize global pipeline
6
  ner_pipeline = None
7
 
@@ -12,7 +16,9 @@ def load_healthcare_ner_pipeline():
12
  ner_pipeline = pipeline(
13
  "token-classification",
14
  model="TypicaAI/HealthcareNER-Fr",
15
- aggregation_strategy="first" # Groups B- and I- tokens into entities
 
 
16
  )
17
  return ner_pipeline
18
 
 
2
  from transformers import pipeline
3
  import os
4
 
5
+ # Set up Hugging Face API token
6
+ from huggingface_hub import login
7
+ login("your-hf-api-token")
8
+
9
  # Initialize global pipeline
10
  ner_pipeline = None
11
 
 
16
  ner_pipeline = pipeline(
17
  "token-classification",
18
  model="TypicaAI/HealthcareNER-Fr",
19
+ aggregation_strategy="first", # Groups B- and I- tokens into entities
20
+ use_auth_token=os.getenv("HFTOKEN") # Use the token for gated models
21
+
22
  )
23
  return ner_pipeline
24