Alexander Bagus commited on
Commit
16bea72
·
1 Parent(s): 8b380db
Files changed (2) hide show
  1. app.py +28 -6
  2. requirements.txt +1 -0
app.py CHANGED
@@ -8,10 +8,10 @@ from diffsynth.pipelines.qwen_image import (
8
  from safetensors.torch import save_file
9
  import torch
10
  from PIL import Image
11
- # from utils import repo_utils, image_utils, prompt_utils
12
 
13
 
14
- # repo_utils.clone_repo_if_not_exists("https://github.com/apple/ml-starflow.git", "app/models")
15
  # repo_utils.clone_repo_if_not_exists("https://huggingface.co/apple/starflow", "app/models")
16
 
17
  DTYPE = torch.bfloat16
@@ -33,9 +33,24 @@ pipe = QwenImagePipeline.from_pretrained(
33
  torch_dtype=torch.bfloat16,
34
  device="cuda",
35
  model_configs=[
36
- ModelConfig(model_id="DiffSynth-Studio/General-Image-Encoders", origin_file_pattern="SigLIP2-G384/model.safetensors", **vram_config_disk_offload),
37
- ModelConfig(model_id="DiffSynth-Studio/General-Image-Encoders", origin_file_pattern="DINOv3-7B/model.safetensors", **vram_config_disk_offload),
38
- ModelConfig(model_id="DiffSynth-Studio/Qwen-Image-i2L", origin_file_pattern="Qwen-Image-i2L-Style.safetensors", **vram_config_disk_offload),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  ],
40
  processor_config=ModelConfig(model_id="Qwen/Qwen-Image-Edit", origin_file_pattern="processor/"),
41
  vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 0.5,
@@ -144,7 +159,14 @@ with gr.Blocks() as demo:
144
  gr.HTML(read_file("static/header.html"))
145
  with gr.Row():
146
  with gr.Column():
147
-
 
 
 
 
 
 
 
148
  prompt = gr.Textbox(
149
  label="Prompt",
150
  show_label=False,
 
8
  from safetensors.torch import save_file
9
  import torch
10
  from PIL import Image
11
+ from utils import repo_utils, image_utils, prompt_utils
12
 
13
 
14
+ # repo_utils.clone_repo_if_not_exists("git clone https://huggingface.co/DiffSynth-Studio/General-Image-Encoders", "app/repos")
15
  # repo_utils.clone_repo_if_not_exists("https://huggingface.co/apple/starflow", "app/models")
16
 
17
  DTYPE = torch.bfloat16
 
33
  torch_dtype=torch.bfloat16,
34
  device="cuda",
35
  model_configs=[
36
+ ModelConfig(
37
+ download_source="huggingface",
38
+ model_id="DiffSynth-Studio/General-Image-Encoders",
39
+ origin_file_pattern="SigLIP2-G384/model.safetensors",
40
+ **vram_config_disk_offload
41
+ ),
42
+ ModelConfig(
43
+ download_source="huggingface",
44
+ model_id="DiffSynth-Studio/General-Image-Encoders",
45
+ origin_file_pattern="DINOv3-7B/model.safetensors",
46
+ **vram_config_disk_offload
47
+ ),
48
+ ModelConfig(
49
+ download_source="huggingface",
50
+ model_id="DiffSynth-Studio/Qwen-Image-i2L",
51
+ origin_file_pattern="Qwen-Image-i2L-Style.safetensors",
52
+ **vram_config_disk_offload
53
+ ),
54
  ],
55
  processor_config=ModelConfig(model_id="Qwen/Qwen-Image-Edit", origin_file_pattern="processor/"),
56
  vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 0.5,
 
159
  gr.HTML(read_file("static/header.html"))
160
  with gr.Row():
161
  with gr.Column():
162
+ gallery = gr.Gallery(
163
+ label="Generated images",
164
+ show_label=False,
165
+ elem_id="gallery",
166
+ columns=2,
167
+ object_fit="cover",
168
+ height=300)
169
+
170
  prompt = gr.Textbox(
171
  label="Prompt",
172
  show_label=False,
requirements.txt CHANGED
@@ -5,3 +5,4 @@ accelerate
5
  spaces
6
  git+https://github.com/huggingface/diffusers.git
7
  git+https://github.com/modelscope/DiffSynth-Studio.git
 
 
5
  spaces
6
  git+https://github.com/huggingface/diffusers.git
7
  git+https://github.com/modelscope/DiffSynth-Studio.git
8
+ python-ulid