Deadmon commited on
Commit
cf4cf62
·
verified ·
1 Parent(s): 0e388ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -19,18 +19,12 @@ GCP_LOCATION = os.environ.get("GCP_LOCATION")
19
 
20
 
21
  # Set up HF_TOKEN for Hugging Face Hub authentication
22
- HF_TOKEN = os.getenv("HF_TOKEN")
23
- if not HF_TOKEN:
24
- raise EnvironmentError(
25
- "HF_TOKEN environment variable not found. Please set it in the Hugging Face Space secrets"
26
- )
27
-
28
- try:
29
- login(token=HF_TOKEN)
30
- except Exception as e:
31
- raise EnvironmentError(
32
- f"Failed to authenticate with HF_TOKEN. Ensure the token has read access."
33
- )
34
 
35
  creds_json_str = os.environ.get("GOOGLE_APPLICATION_CREDENTIALS_JSON")
36
 
 
19
 
20
 
21
  # Set up HF_TOKEN for Hugging Face Hub authentication
22
+ hf_token = os.environ.get("HF_TOKEN")
23
+ if hf_token:
24
+ print("Hugging Face token found. Logging in.")
25
+ login(token=hf_token)
26
+ else:
27
+ print("WARNING: Hugging Face token ('HF_TOKEN') not found. Hub-related features may be disabled.")
 
 
 
 
 
 
28
 
29
  creds_json_str = os.environ.get("GOOGLE_APPLICATION_CREDENTIALS_JSON")
30