Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ from transformers import pipeline
|
|
3 |
from huggingface_hub import login
|
4 |
import os
|
5 |
|
6 |
-
|
7 |
# Initialize global pipeline
|
8 |
ner_pipeline = None
|
9 |
|
@@ -19,6 +18,10 @@ def load_healthcare_ner_pipeline():
|
|
19 |
"""Load the Hugging Face pipeline for Healthcare NER."""
|
20 |
global ner_pipeline
|
21 |
if ner_pipeline is None:
|
|
|
|
|
|
|
|
|
22 |
ner_pipeline = pipeline(
|
23 |
"token-classification",
|
24 |
model="TypicaAI/HealthcareNER-Fr",
|
@@ -38,12 +41,6 @@ def log_demo_usage(text, num_entities):
|
|
38 |
"""Log demo usage for analytics."""
|
39 |
print(f"Processed text: {text[:50]}... | Entities found: {num_entities}")
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
# Authenticate and initialize pipeline
|
45 |
-
authenticate_with_token()
|
46 |
-
|
47 |
# Define the main demo interface
|
48 |
demo = gr.Interface(
|
49 |
fn=process_text,
|
|
|
3 |
from huggingface_hub import login
|
4 |
import os
|
5 |
|
|
|
6 |
# Initialize global pipeline
|
7 |
ner_pipeline = None
|
8 |
|
|
|
18 |
"""Load the Hugging Face pipeline for Healthcare NER."""
|
19 |
global ner_pipeline
|
20 |
if ner_pipeline is None:
|
21 |
+
|
22 |
+
# Authenticate and initialize pipeline
|
23 |
+
authenticate_with_token()
|
24 |
+
|
25 |
ner_pipeline = pipeline(
|
26 |
"token-classification",
|
27 |
model="TypicaAI/HealthcareNER-Fr",
|
|
|
41 |
"""Log demo usage for analytics."""
|
42 |
print(f"Processed text: {text[:50]}... | Entities found: {num_entities}")
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
# Define the main demo interface
|
45 |
demo = gr.Interface(
|
46 |
fn=process_text,
|