Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,13 @@ import vertexai
|
|
6 |
from vertexai.preview.vision_models import ImageGenerationModel
|
7 |
|
8 |
# --- 1. Authentication and Initialization ---
|
9 |
-
#
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
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:
|