Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,6 @@ import os
|
|
| 8 |
|
| 9 |
# Imports Hugging Face
|
| 10 |
from huggingface_hub import hf_hub_download, login
|
| 11 |
-
from google.colab import userdata
|
| 12 |
|
| 13 |
# Imports locaux
|
| 14 |
from modeling.BaseModel import BaseModel
|
|
@@ -22,7 +21,10 @@ from inference_utils.processing_utils import read_rgb, get_instances
|
|
| 22 |
|
| 23 |
def init_huggingface():
|
| 24 |
"""Initialise la connexion Hugging Face et télécharge le modèle."""
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
| 26 |
return hf_hub_download(
|
| 27 |
repo_id="microsoft/BiomedParse",
|
| 28 |
filename="biomedparse_v1.pt",
|
|
|
|
| 8 |
|
| 9 |
# Imports Hugging Face
|
| 10 |
from huggingface_hub import hf_hub_download, login
|
|
|
|
| 11 |
|
| 12 |
# Imports locaux
|
| 13 |
from modeling.BaseModel import BaseModel
|
|
|
|
| 21 |
|
| 22 |
def init_huggingface():
|
| 23 |
"""Initialise la connexion Hugging Face et télécharge le modèle."""
|
| 24 |
+
hf_token = os.getenv('HF_TOKEN')
|
| 25 |
+
if hf_token is None:
|
| 26 |
+
raise ValueError("Hugging Face token not found. Please set the HF_TOKEN environment variable.")
|
| 27 |
+
login(hf_token)
|
| 28 |
return hf_hub_download(
|
| 29 |
repo_id="microsoft/BiomedParse",
|
| 30 |
filename="biomedparse_v1.pt",
|