Spaces:
Build error
Build error
Download flux.py from aliasystems/README: direct link, hf CLI and curl.
- Browser
- Download file 699 Bytes
-
https://huggingface.co/spaces/aliasystems/README/resolve/main/flux.py
- Command line
-
hf download hf://spaces/aliasystems/README/flux.py
-
curl -L -o flux.py https://huggingface.co/spaces/aliasystems/README/resolve/main/flux.py
699 Bytes
| from dotenv import load_dotenv | |
| import os | |
| load_dotenv() # Load the environment variables from .env | |
| # Access the token | |
| access_token = os.getenv("HUGGING_FACE_HUB_TOKEN") | |
| import torch | |
| from diffusers import FluxPipeline | |
| pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16) | |
| pipe.enable_model_cpu_offload() | |
| prompt = "A homeless cat holding a sign which says, 'Will Youtube for Food'" | |
| image = pipe( | |
| prompt, | |
| height=1024, | |
| width=1024, | |
| guidance_scale=3.5, | |
| num_inference_steps=50, | |
| max_sequence_length=512, | |
| generator=torch.Generator("cpu").manual_seed(0) | |
| ).images[0] | |
| image.save("fluxpng.dev") | |