Deadmon commited on
Commit
7dd4b5c
·
verified ·
1 Parent(s): e5c9829

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -6,9 +6,13 @@ import vertexai
6
  from vertexai.preview.vision_models import ImageGenerationModel
7
 
8
  # --- 1. Authentication and Initialization ---
9
- # This section handles secure authentication with Google Cloud.
10
- # It expects the GCP credentials to be stored in a Hugging Face Secret
11
- # named "GOOGLE_APPLICATION_CREDENTIALS_JSON".
 
 
 
 
12
 
13
  # Check if the secret is available
14
  if "GOOGLE_APPLICATION_CREDENTIALS_JSON" in os.environ:
 
6
  from vertexai.preview.vision_models import ImageGenerationModel
7
 
8
  # --- 1. Authentication and Initialization ---
9
+ # Part A: Hugging Face Hub Authentication
10
+ hf_token = os.environ.get("HF_TOKEN")
11
+ if hf_token:
12
+ print("Hugging Face token found. Logging in.")
13
+ login(token=hf_token)
14
+ else:
15
+ print("WARNING: Hugging Face token ('HF_TOKEN') not found. Hub-related features may be disabled.")
16
 
17
  # Check if the secret is available
18
  if "GOOGLE_APPLICATION_CREDENTIALS_JSON" in os.environ: