Gerasimo commited on
Commit
048b7db
·
verified ·
1 Parent(s): cd47f99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -42,14 +42,8 @@ pipe = QwenImageEditPlusPipeline.from_pretrained(
42
  device_map="cuda",
43
  ),
44
  torch_dtype=dtype,
45
- safety_checker=None, # <-- Добавьте эту строку
46
- feature_extractor=None, # <-- Добавьте эту строку
47
  ).to(device)
48
 
49
- # Отключение проверки на уровне экземпляра pipeline
50
- if hasattr(pipe, "safety_checker"):
51
- pipe.safety_checker = None
52
-
53
  try:
54
  pipe.transformer.set_attn_processor(QwenDoubleStreamAttnProcessorFA3())
55
  print("Flash Attention 3 Processor set successfully.")
@@ -182,14 +176,13 @@ def b64_to_pil_list(b64_json_str):
182
 
183
  def update_dimensions_on_upload(image):
184
  if image is None:
185
- return 1024, 1024
186
  w, h = image.size
187
- target_dim = 1024
188
  if w > h:
189
- nw = target_dim
190
  nh = int(nw * h / w)
191
  else:
192
- nh = target_dim
193
  nw = int(nh * w / h)
194
  return (nw // 8) * 8, (nh // 8) * 8
195
 
@@ -206,7 +199,7 @@ def infer(images_b64_json, prompt, seed, randomize_seed, guidance_scale, steps,
206
  if randomize_seed:
207
  seed = random.randint(0, MAX_SEED)
208
  generator = torch.Generator(device=device).manual_seed(seed)
209
- negative_prompt = "blurry, low resolution, low quality, soft details, artifacts, pixelated, plastic skin, smooth skin, 3d render, cartoon, anime, blurry, low resolution, bad anatomy, overprocessed, oversaturated, painting, drawing"
210
  width, height = update_dimensions_on_upload(pil_images[0])
211
  try:
212
  result_image = pipe(
 
42
  device_map="cuda",
43
  ),
44
  torch_dtype=dtype,
 
 
45
  ).to(device)
46
 
 
 
 
 
47
  try:
48
  pipe.transformer.set_attn_processor(QwenDoubleStreamAttnProcessorFA3())
49
  print("Flash Attention 3 Processor set successfully.")
 
176
 
177
  def update_dimensions_on_upload(image):
178
  if image is None:
179
+ return 1024, 1024
180
  w, h = image.size
 
181
  if w > h:
182
+ nw = 1024
183
  nh = int(nw * h / w)
184
  else:
185
+ nh = 1024
186
  nw = int(nh * w / h)
187
  return (nw // 8) * 8, (nh // 8) * 8
188
 
 
199
  if randomize_seed:
200
  seed = random.randint(0, MAX_SEED)
201
  generator = torch.Generator(device=device).manual_seed(seed)
202
+ negative_prompt = "worst quality, low quality, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, jpeg artifacts, signature, watermark, username, blurry"
203
  width, height = update_dimensions_on_upload(pil_images[0])
204
  try:
205
  result_image = pipe(