ovi054 commited on
Commit
b42dd5a
·
verified ·
1 Parent(s): 598982c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -3,7 +3,7 @@ import numpy as np
3
  import random
4
  import spaces
5
  import torch
6
- from diffusers import DiffusionPipeline
7
 
8
  import os
9
  import requests
@@ -16,7 +16,7 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
16
 
17
 
18
  # Load the model pipeline
19
- pipe = DiffusionPipeline.from_pretrained("meituan-longcat/LongCat-Image", trust_remote_code=True, torch_dtype=dtype).to(device)
20
 
21
  torch.cuda.empty_cache()
22
 
@@ -85,8 +85,7 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidan
85
  height=height,
86
  num_inference_steps=num_inference_steps,
87
  generator=generator,
88
- true_cfg_scale=guidance_scale,
89
- guidance_scale=1.0 # Use a fixed default for distilled guidance
90
  ).images[0]
91
  print("Image Generation Completed for: ", prompt, lora_id)
92
  return image, seed
@@ -141,8 +140,8 @@ with gr.Blocks(css=css) as app:
141
  seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=4294967296, step=1)
142
  randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
143
  with gr.Row():
144
- steps = gr.Slider(label="Inference steps steps", value=28, minimum=1, maximum=100, step=1)
145
- cfg = gr.Slider(label="Guidance Scale", value=4.5, minimum=1, maximum=20, step=0.5)
146
  # method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
147
 
148
  with gr.Row():
 
3
  import random
4
  import spaces
5
  import torch
6
+ from diffusers import ZImagePipeline
7
 
8
  import os
9
  import requests
 
16
 
17
 
18
  # Load the model pipeline
19
+ pipe = ZImagePipeline.from_pretrained("Tongyi-MAI/Z-Image-Turbo", torch_dtype=dtype, low_cpu_mem_usage=False).to(device)
20
 
21
  torch.cuda.empty_cache()
22
 
 
85
  height=height,
86
  num_inference_steps=num_inference_steps,
87
  generator=generator,
88
+ guidance_scale=guidance_scale # Use a fixed default for distilled guidance
 
89
  ).images[0]
90
  print("Image Generation Completed for: ", prompt, lora_id)
91
  return image, seed
 
140
  seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=4294967296, step=1)
141
  randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
142
  with gr.Row():
143
+ steps = gr.Slider(label="Inference steps steps", value=9, minimum=1, maximum=20, step=1)
144
+ cfg = gr.Slider(label="Guidance Scale", value=0, minimum=0, maximum=20, step=0.5)
145
  # method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
146
 
147
  with gr.Row():