@@ -474,7 +474,24 @@ def run_generate(*inputs):
474474
475475 show_images = []
476476 inpainted_mesh_fi = mesh_simple_fi = None
477- for input_i , type , result in gen_obj :
477+ msg = "" # Empty string is never returned
478+ while True :
479+ try :
480+ input_i , type , result = next (gen_obj )
481+ except StopIteration :
482+ # TODO: return more info
483+ msg = '<h3>Successfully generated.</h3>'
484+ break
485+ except Exception as e :
486+ traceback .print_exc ()
487+ msg = '<h3>' + 'ERROR: ' + str (e ) + '</h3>' + '\n '
488+ if 'out of GPU memory' not in msg :
489+ msg += \
490+ 'Please report this issue ' \
491+ f'<a href="https://github.com/thygate/{ REPOSITORY_NAME } /issues">here</a>. ' \
492+ 'Make sure to provide the full stacktrace: \n '
493+ msg += '<code style="white-space: pre;">' + traceback .format_exc () + '</code>'
494+ break
478495 if type == 'simple_mesh' :
479496 mesh_simple_fi = result
480497 continue
@@ -507,5 +524,4 @@ def run_generate(*inputs):
507524 if backbone .get_opt ('depthmap_script_show_3d_inpaint' , True ):
508525 if inpainted_mesh_fi is not None and len (inpainted_mesh_fi ) > 0 :
509526 display_mesh_fi = inpainted_mesh_fi
510- # TODO: return more info
511- return show_images , inpainted_mesh_fi , display_mesh_fi , 'Generated!'
527+ return show_images , inpainted_mesh_fi , display_mesh_fi , msg .replace ('\n ' , '<br>' )
0 commit comments