multimodalart HF Staff commited on
Commit
63fe863
·
verified ·
1 Parent(s): a5fa6d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -6,8 +6,7 @@ import random
6
  import json
7
  import os
8
  from PIL import Image
9
- from kontext_pipeline import FluxKontextPipeline
10
- from diffusers import FluxTransformer2DModel
11
  from diffusers.utils import load_image
12
  from huggingface_hub import hf_hub_download, HfFileSystem, ModelCard
13
  from safetensors.torch import load_file
@@ -15,11 +14,9 @@ import requests
15
  import re
16
 
17
  # Load Kontext model
18
- kontext_path = hf_hub_download(repo_id="diffusers/kontext-v2", filename="dev-opt-2-a-3.safetensors")
19
  MAX_SEED = np.iinfo(np.int32).max
20
 
21
- transformer = FluxTransformer2DModel.from_single_file(kontext_path, torch_dtype=torch.bfloat16)
22
- pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", transformer=transformer, torch_dtype=torch.bfloat16).to("cuda")
23
 
24
  # Load LoRA data (you'll need to create this JSON file or modify to load your LoRAs)
25
 
 
6
  import json
7
  import os
8
  from PIL import Image
9
+ from diffusers import FluxKontextPipeline
 
10
  from diffusers.utils import load_image
11
  from huggingface_hub import hf_hub_download, HfFileSystem, ModelCard
12
  from safetensors.torch import load_file
 
14
  import re
15
 
16
  # Load Kontext model
 
17
  MAX_SEED = np.iinfo(np.int32).max
18
 
19
+ pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16).to("cuda")
 
20
 
21
  # Load LoRA data (you'll need to create this JSON file or modify to load your LoRAs)
22