Upload black-forest-labs_FLUX.1-Kontext-dev_1.py with huggingface_hub
Browse files3 unmodified lines45678910119 unmodified lines2122232425262728252930313213 unmodified lines464748495051525348545556573 unmodified lines# "numpy",# "einops",# "pandas",# "matplotlib",# "paddleorc",# "protobuf",# "torch",# "sentencepiece",9 unmodified lines# ///
try: import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev") pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")13 unmodified lines with open('black-forest-labs_FLUX.1-Kontext-dev_1.txt', 'a', encoding='utf-8') as f: import traceback f.write('''```CODE: import torchfrom diffusers import DiffusionPipelinefrom diffusers.utils import load_image
# switch to "mps" for apple devicespipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev")pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", dtype=torch.bfloat16, device_map="cuda")
prompt = "Turn this cat into a dog"input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")black-forest-labs_FLUX.1-Kontext-dev_1.py+8-2