Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,14 @@
|
|
1 |
from diffusers import StableDiffusionPipeline
|
2 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
# Load the Stable Diffusion 3.5 model
|
5 |
model_id = "stabilityai/stable-diffusion-3.5"
|
|
|
1 |
from diffusers import StableDiffusionPipeline
|
2 |
import torch
|
3 |
+
import os
|
4 |
+
from huggingface_hub import login
|
5 |
+
|
6 |
+
# Retrieve the token from the environment variable
|
7 |
+
token = os.getenv("HF_TOKEN") # Hugging Face token from the secret
|
8 |
+
if token:
|
9 |
+
login(token=token) # Log in with the retrieved token
|
10 |
+
else:
|
11 |
+
raise ValueError("Hugging Face token not found. Please set it as a repository secret in the Space settings.")
|
12 |
|
13 |
# Load the Stable Diffusion 3.5 model
|
14 |
model_id = "stabilityai/stable-diffusion-3.5"
|