hvoss-techfak commited on
Commit
043831b
·
1 Parent(s): 3296634

better visible error message

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -865,6 +865,20 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
865
  time.sleep(0.05)
866
 
867
  worker.join() # make sure it’s done
 
 
 
 
 
 
 
 
 
 
 
 
 
 
868
  return_code = worker.returncode
869
 
870
  try:
 
865
  time.sleep(0.05)
866
 
867
  worker.join() # make sure it’s done
868
+
869
+ # If the GPU scheduler threw, we already wrote the text into the log.
870
+ # Just read the tail once more so it reaches the UI textbox.
871
+ with open(log_file, "r", encoding="utf-8") as lf:
872
+ lf.seek(file_pos)
873
+ log_output += lf.read()
874
+
875
+ if worker.exc is not None:
876
+ # Do NOT raise – raising would hide the explanation behind Gradio’s generic banner.
877
+ return (
878
+ "".join(log_output),
879
+ None, # no preview
880
+ gr.update(visible=False, interactive=False),
881
+ )
882
  return_code = worker.returncode
883
 
884
  try: