Upload black-forest-labs_FLUX.1-Kontext-dev_0.py with huggingface_hub
Browse files
black-forest-labs_FLUX.1-Kontext-dev_0.py
CHANGED
|
@@ -14,6 +14,16 @@
|
|
| 14 |
try:
|
| 15 |
from huggingface_hub import login
|
| 16 |
login(new_session=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
with open('black-forest-labs_FLUX.1-Kontext-dev_0.txt', 'w') as f:
|
| 18 |
f.write('Everything was good in black-forest-labs_FLUX.1-Kontext-dev_0.txt')
|
| 19 |
except Exception as e:
|
|
|
|
| 14 |
try:
|
| 15 |
from huggingface_hub import login
|
| 16 |
login(new_session=False)
|
| 17 |
+
|
| 18 |
+
from diffusers import DiffusionPipeline
|
| 19 |
+
from diffusers.utils import load_image
|
| 20 |
+
|
| 21 |
+
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev")
|
| 22 |
+
|
| 23 |
+
prompt = "Turn this cat into a dog"
|
| 24 |
+
input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")
|
| 25 |
+
|
| 26 |
+
image = pipe(image=input_image, prompt=prompt).images[0]
|
| 27 |
with open('black-forest-labs_FLUX.1-Kontext-dev_0.txt', 'w') as f:
|
| 28 |
f.write('Everything was good in black-forest-labs_FLUX.1-Kontext-dev_0.txt')
|
| 29 |
except Exception as e:
|