Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,12 +44,6 @@ pipe = QwenImageEditPlusPipeline.from_pretrained(
|
|
| 44 |
torch_dtype=dtype,
|
| 45 |
).to(device)
|
| 46 |
|
| 47 |
-
# --- ОТКЛЮЧЕНИЕ ВСЕХ ФИЛЬТРОВ И ЦЕНЗУРЫ НА ВЫХОДЕ ---
|
| 48 |
-
if hasattr(pipe, "safety_checker"):
|
| 49 |
-
pipe.safety_checker = None
|
| 50 |
-
if hasattr(pipe, "requires_safety_checker"):
|
| 51 |
-
pipe.requires_safety_checker = False
|
| 52 |
-
# ----------------------------------------------------
|
| 53 |
try:
|
| 54 |
pipe.transformer.set_attn_processor(QwenDoubleStreamAttnProcessorFA3())
|
| 55 |
print("Flash Attention 3 Processor set successfully.")
|
|
@@ -1156,23 +1150,19 @@ with gr.Blocks() as demo:
|
|
| 1156 |
demo.load(fn=None, js=gallery_js)
|
| 1157 |
demo.load(fn=None, js=wire_outputs_js)
|
| 1158 |
|
| 1159 |
-
run_btn.click(
|
| 1160 |
-
|
| 1161 |
-
|
| 1162 |
-
|
| 1163 |
-
|
| 1164 |
-
|
| 1165 |
-
|
| 1166 |
-
|
| 1167 |
-
|
| 1168 |
-
|
| 1169 |
-
|
| 1170 |
-
|
| 1171 |
-
|
| 1172 |
-
|
| 1173 |
-
return [imgsJson, promptVal, s, rs, gs, st];
|
| 1174 |
-
}""",
|
| 1175 |
-
)
|
| 1176 |
|
| 1177 |
example_load_btn.click(
|
| 1178 |
fn=load_example_data,
|
|
|
|
| 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.")
|
|
|
|
| 1150 |
demo.load(fn=None, js=gallery_js)
|
| 1151 |
demo.load(fn=None, js=wire_outputs_js)
|
| 1152 |
|
| 1153 |
+
run_btn.click(
|
| 1154 |
+
fn=infer,
|
| 1155 |
+
inputs=[hidden_images_b64, prompt, seed, randomize_seed, guidance_scale, steps],
|
| 1156 |
+
outputs=[result, seed],
|
| 1157 |
+
js=r"""(imgs, p, s, rs, gs, st) => {
|
| 1158 |
+
const images = window.__uploadedImages || [];
|
| 1159 |
+
const b64Array = images.map(img => img.b64);
|
| 1160 |
+
const imgsJson = JSON.stringify(b64Array);
|
| 1161 |
+
const promptEl = document.getElementById('custom-prompt-input');
|
| 1162 |
+
const promptVal = promptEl ? promptEl.value : p;
|
| 1163 |
+
return [imgsJson, promptVal, s, rs, gs, st];
|
| 1164 |
+
}""",
|
| 1165 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1166 |
|
| 1167 |
example_load_btn.click(
|
| 1168 |
fn=load_example_data,
|