Spaces:
Sleeping
Sleeping
Commit ·
e00b7f3
1
Parent(s): a6c0725
Fix: use local HF cache directory to avoid permission error
Browse files
app.py
CHANGED
|
@@ -6,6 +6,11 @@ os.environ["MPLCONFIGDIR"] = "/tmp/mplconfig"
|
|
| 6 |
os.makedirs("/tmp/huggingface", exist_ok=True)
|
| 7 |
os.makedirs("/tmp/mplconfig", exist_ok=True)
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
|
|
|
|
| 6 |
os.makedirs("/tmp/huggingface", exist_ok=True)
|
| 7 |
os.makedirs("/tmp/mplconfig", exist_ok=True)
|
| 8 |
|
| 9 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
| 10 |
+
|
| 11 |
+
# Load the NER model
|
| 12 |
+
tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
|
| 13 |
+
model = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
|
| 14 |
|
| 15 |
|
| 16 |
|