DonImages commited on
Commit
d985a28
·
verified ·
1 Parent(s): 3825736

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
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"