Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -416,7 +416,6 @@ def run_lora(prompt, image_input, image_strength, cfg_scale, steps, selected_ind
|
|
416 |
if randomize_seed:
|
417 |
seed = random.randint(0, MAX_SEED)
|
418 |
|
419 |
-
|
420 |
# Generate image
|
421 |
if image_input is not None:
|
422 |
final_image = generate_image_to_image(prompt_mash, image_input, image_strength, steps, cfg_scale, width, height, seed)
|
@@ -434,13 +433,9 @@ def run_lora(prompt, image_input, image_strength, cfg_scale, steps, selected_ind
|
|
434 |
raise gr.Error("Failed to generate image")
|
435 |
|
436 |
return final_image, seed, gr.update(visible=False)
|
437 |
-
except spaces.zero.gradio.HTMLError as e:
|
438 |
-
if "You have exceeded your Pro GPU quota" in str(e):
|
439 |
-
return gr.Error("GPU quota exceeded. Please try again later."), seed, gr.update(visible=False)
|
440 |
-
raise
|
441 |
except Exception as e:
|
442 |
print(f"Error in run_lora: {str(e)}")
|
443 |
-
return gr.Error(
|
444 |
|
445 |
run_lora.zerogpu = True
|
446 |
|
@@ -497,7 +492,8 @@ def update_history(new_image, history):
|
|
497 |
"""Updates the history gallery with the new image."""
|
498 |
if history is None:
|
499 |
history = []
|
500 |
-
|
|
|
501 |
return history
|
502 |
|
503 |
css = '''
|
|
|
416 |
if randomize_seed:
|
417 |
seed = random.randint(0, MAX_SEED)
|
418 |
|
|
|
419 |
# Generate image
|
420 |
if image_input is not None:
|
421 |
final_image = generate_image_to_image(prompt_mash, image_input, image_strength, steps, cfg_scale, width, height, seed)
|
|
|
433 |
raise gr.Error("Failed to generate image")
|
434 |
|
435 |
return final_image, seed, gr.update(visible=False)
|
|
|
|
|
|
|
|
|
436 |
except Exception as e:
|
437 |
print(f"Error in run_lora: {str(e)}")
|
438 |
+
return gr.Error(str(e)), seed, gr.update(visible=False)
|
439 |
|
440 |
run_lora.zerogpu = True
|
441 |
|
|
|
492 |
"""Updates the history gallery with the new image."""
|
493 |
if history is None:
|
494 |
history = []
|
495 |
+
if not isinstance(new_image, gr.Error):
|
496 |
+
history.insert(0, new_image)
|
497 |
return history
|
498 |
|
499 |
css = '''
|