Spaces:
Running
Running
Hakyung Sung
commited on
Commit
·
5ec5649
1
Parent(s):
2a266ff
Add requirements.txt file
Browse files
app.py
CHANGED
@@ -7,13 +7,14 @@ import base64
|
|
7 |
import io
|
8 |
from huggingface_hub import snapshot_download
|
9 |
from PIL import Image
|
|
|
10 |
|
11 |
# Download the model from Hugging Face Hub
|
12 |
model_repo = "hksung/ASC_tagger_v2"
|
13 |
model_path = snapshot_download(model_repo) # Assumes the repo is public; add token if needed
|
14 |
|
15 |
# Load the spaCy model
|
16 |
-
nlp = spacy.load(model_path)
|
17 |
|
18 |
# Make sure the pipeline can split into sentences
|
19 |
if 'parser' not in nlp.pipe_names and 'senter' not in nlp.pipe_names:
|
|
|
7 |
import io
|
8 |
from huggingface_hub import snapshot_download
|
9 |
from PIL import Image
|
10 |
+
import os
|
11 |
|
12 |
# Download the model from Hugging Face Hub
|
13 |
model_repo = "hksung/ASC_tagger_v2"
|
14 |
model_path = snapshot_download(model_repo) # Assumes the repo is public; add token if needed
|
15 |
|
16 |
# Load the spaCy model
|
17 |
+
nlp = spacy.load(os.path.join(model_path, 'model-best'))
|
18 |
|
19 |
# Make sure the pipeline can split into sentences
|
20 |
if 'parser' not in nlp.pipe_names and 'senter' not in nlp.pipe_names:
|