anttirauhala commited on
Commit
ac72ab2
·
verified ·
1 Parent(s): 7a629bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -10,6 +10,11 @@ import json
10
  import os
11
  from huggingface_hub import hf_hub_download
12
 
 
 
 
 
 
13
  # In a Hugging Face Space, authentication is handled by the environment
14
  # No need to explicitly set a token in the Space environment
15
  try:
@@ -19,7 +24,8 @@ try:
19
  # First try with force_download
20
  model_path = hf_hub_download(repo_id="tech4humans/yolov8s-signature-detector",
21
  filename="yolov8s.pt",
22
- force_download=True) # Force download for Space environment
 
23
  except Exception as force_error:
24
  print(f"Force download failed: {str(force_error)}")
25
  # Try again without force_download
 
10
  import os
11
  from huggingface_hub import hf_hub_download
12
 
13
+ from huggingface_hub import login
14
+
15
+ login(mytoken = os.environ["HUGGINGFACE_TOKEN"],add_to_git_credential=True)
16
+
17
+
18
  # In a Hugging Face Space, authentication is handled by the environment
19
  # No need to explicitly set a token in the Space environment
20
  try:
 
24
  # First try with force_download
25
  model_path = hf_hub_download(repo_id="tech4humans/yolov8s-signature-detector",
26
  filename="yolov8s.pt",
27
+ force_download=True,
28
+ token=mytoken) # Force download for Space environment
29
  except Exception as force_error:
30
  print(f"Force download failed: {str(force_error)}")
31
  # Try again without force_download