Spaces:
No application file
No application file
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +4 -1
src/streamlit_app.py
CHANGED
|
@@ -9,8 +9,11 @@ import torch
|
|
| 9 |
from transformers import DetrImageProcessor, DetrForObjectDetection
|
| 10 |
from huggingface_hub import login
|
| 11 |
|
| 12 |
-
#
|
| 13 |
HUGGINGFACE_TOKEN = os.environ.get("HF_TOKEN")
|
|
|
|
|
|
|
|
|
|
| 14 |
login(token=HUGGINGFACE_TOKEN)
|
| 15 |
|
| 16 |
# === Load Model and Processor ===
|
|
|
|
| 9 |
from transformers import DetrImageProcessor, DetrForObjectDetection
|
| 10 |
from huggingface_hub import login
|
| 11 |
|
| 12 |
+
# Secure token handling
|
| 13 |
HUGGINGFACE_TOKEN = os.environ.get("HF_TOKEN")
|
| 14 |
+
if HUGGINGFACE_TOKEN is None:
|
| 15 |
+
raise ValueError("Hugging Face token not found in environment. Please set HF_TOKEN in Space secrets.")
|
| 16 |
+
|
| 17 |
login(token=HUGGINGFACE_TOKEN)
|
| 18 |
|
| 19 |
# === Load Model and Processor ===
|