Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,9 @@ import torch
|
|
| 4 |
from diffusers import FluxPipeline
|
| 5 |
from groq import Groq # Import the Groq library
|
| 6 |
from cryptography.fernet import Fernet
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def get_hf_token(encrypted_token):
|
| 9 |
# Retrieve the decryption key from an environment variable
|
|
@@ -20,10 +23,10 @@ def get_hf_token(encrypted_token):
|
|
| 20 |
decrypted_token = f.decrypt(encrypted_token).decode()
|
| 21 |
return decrypted_token
|
| 22 |
decrypted_token = get_hf_token("gAAAAABn3GfShExoJd50nau3B5ZJNiQ9dRD1ACO3XXMwVaIQMkmi59cL-MKGr6SYnsB0E2gGITJG2j29Ar9yjaZP-EC6hHsCBmwKSj4aFtTor9_n0_NdMBv1GtlxZRmwnQwriB-Xr94e")
|
|
|
|
| 23 |
pipe = FluxPipeline.from_pretrained(
|
| 24 |
"black-forest-labs/FLUX.1-dev",
|
| 25 |
-
torch_dtype=torch.bfloat16
|
| 26 |
-
use_auth_token=decrypted_token # Replace with your actual token
|
| 27 |
)
|
| 28 |
pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
|
| 29 |
|
|
|
|
| 4 |
from diffusers import FluxPipeline
|
| 5 |
from groq import Groq # Import the Groq library
|
| 6 |
from cryptography.fernet import Fernet
|
| 7 |
+
from huggingface_hub import login
|
| 8 |
+
|
| 9 |
+
# Replace 'your_access_token' with your actual token
|
| 10 |
|
| 11 |
def get_hf_token(encrypted_token):
|
| 12 |
# Retrieve the decryption key from an environment variable
|
|
|
|
| 23 |
decrypted_token = f.decrypt(encrypted_token).decode()
|
| 24 |
return decrypted_token
|
| 25 |
decrypted_token = get_hf_token("gAAAAABn3GfShExoJd50nau3B5ZJNiQ9dRD1ACO3XXMwVaIQMkmi59cL-MKGr6SYnsB0E2gGITJG2j29Ar9yjaZP-EC6hHsCBmwKSj4aFtTor9_n0_NdMBv1GtlxZRmwnQwriB-Xr94e")
|
| 26 |
+
login(token=decrypted_token)
|
| 27 |
pipe = FluxPipeline.from_pretrained(
|
| 28 |
"black-forest-labs/FLUX.1-dev",
|
| 29 |
+
torch_dtype=torch.bfloat16
|
|
|
|
| 30 |
)
|
| 31 |
pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
|
| 32 |
|