Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -271,11 +271,12 @@ def generate_grid(prompt, selected_models, custom_lora, negative_prompt, steps,
|
|
271 |
|
272 |
# 초기 이미지 배열 생성
|
273 |
images = [None] * 4
|
|
|
274 |
|
275 |
# 각 모델별로 이미지 생성
|
276 |
for idx, model_name in enumerate(selected_models[:4]):
|
277 |
try:
|
278 |
-
progress(idx /
|
279 |
img = query(prompt, model_name, custom_lora, negative_prompt, steps, cfg_scale, seed, strength, width, height)
|
280 |
images[idx] = img
|
281 |
except Exception as e:
|
@@ -292,30 +293,6 @@ def generate_grid(prompt, selected_models, custom_lora, negative_prompt, steps,
|
|
292 |
progress(1.0, "Generation complete!")
|
293 |
return images
|
294 |
|
295 |
-
|
296 |
-
def update_gallery():
|
297 |
-
return images
|
298 |
-
|
299 |
-
# 각 모델별로 이미지 생성
|
300 |
-
for idx, model_name in enumerate(selected_models[:4]):
|
301 |
-
try:
|
302 |
-
img = query(prompt, model_name, custom_lora, negative_prompt, steps, cfg_scale, seed, strength, width, height)
|
303 |
-
images[idx] = img
|
304 |
-
# 갤러리 업데이트를 위해 중간 결과 반환
|
305 |
-
yield images
|
306 |
-
except Exception as e:
|
307 |
-
print(f"Error generating image for {model_name}: {str(e)}")
|
308 |
-
continue
|
309 |
-
|
310 |
-
# 남은 슬롯을 마지막 생성된 이미지로 채움
|
311 |
-
last_valid_image = next((img for img in reversed(images) if img is not None), None)
|
312 |
-
if last_valid_image:
|
313 |
-
for i in range(len(images)):
|
314 |
-
if images[i] is None:
|
315 |
-
images[i] = last_valid_image
|
316 |
-
|
317 |
-
yield images
|
318 |
-
|
319 |
css = """
|
320 |
footer {
|
321 |
visibility: hidden;
|
|
|
271 |
|
272 |
# 초기 이미지 배열 생성
|
273 |
images = [None] * 4
|
274 |
+
total_models = len(selected_models[:4])
|
275 |
|
276 |
# 각 모델별로 이미지 생성
|
277 |
for idx, model_name in enumerate(selected_models[:4]):
|
278 |
try:
|
279 |
+
progress((idx + 1) / total_models, f"Generating image for {model_name}...")
|
280 |
img = query(prompt, model_name, custom_lora, negative_prompt, steps, cfg_scale, seed, strength, width, height)
|
281 |
images[idx] = img
|
282 |
except Exception as e:
|
|
|
293 |
progress(1.0, "Generation complete!")
|
294 |
return images
|
295 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
css = """
|
297 |
footer {
|
298 |
visibility: hidden;
|