Spaces:
Runtime error
Runtime error
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -34,9 +34,12 @@ model_dict = {}
|
|
| 34 |
def init_flux_pipeline():
|
| 35 |
global pipe
|
| 36 |
if pipe is None:
|
|
|
|
|
|
|
|
|
|
| 37 |
pipe = FluxPipeline.from_pretrained(
|
| 38 |
-
"black-forest-labs/FLUX.1-
|
| 39 |
-
use_auth_token=
|
| 40 |
torch_dtype=torch.bfloat16
|
| 41 |
)
|
| 42 |
pipe = pipe.to("cuda")
|
|
|
|
| 34 |
def init_flux_pipeline():
|
| 35 |
global pipe
|
| 36 |
if pipe is None:
|
| 37 |
+
token = os.getenv("HF_TOKEN")
|
| 38 |
+
if not token:
|
| 39 |
+
raise ValueError("HF_TOKEN environment variable not set.")
|
| 40 |
pipe = FluxPipeline.from_pretrained(
|
| 41 |
+
"black-forest-labs/FLUX.1-dev",
|
| 42 |
+
use_auth_token=token,
|
| 43 |
torch_dtype=torch.bfloat16
|
| 44 |
)
|
| 45 |
pipe = pipe.to("cuda")
|