Spaces:
Running
on
Zero
Running
on
Zero
Improve error visibility: Add scroll reminder and increase status box size
Browse files- Increase status box lines from 12 to 15, max_lines from 20 to 50
- Add copy button to status box for easy error message copying
- Add reminder at top of error messages to scroll down
- Better timeout error handling
- Ensure all errors are caught and displayed properly
app.py
CHANGED
|
@@ -286,6 +286,8 @@ def _generate_image_impl(prompt, aspect_ratio, cfg, seed, checkpoint_file, confi
|
|
| 286 |
|
| 287 |
if result.returncode != 0:
|
| 288 |
error_msg = f"β Error during generation (return code: {result.returncode})\n\n"
|
|
|
|
|
|
|
| 289 |
|
| 290 |
# Check for GPU abort or CUDA errors
|
| 291 |
error_output = (result.stderr + result.stdout).lower()
|
|
@@ -344,6 +346,8 @@ def _generate_image_impl(prompt, aspect_ratio, cfg, seed, checkpoint_file, confi
|
|
| 344 |
return None, error_msg
|
| 345 |
|
| 346 |
status_msg += "Generation complete. Looking for output...\n"
|
|
|
|
|
|
|
| 347 |
|
| 348 |
# Find the generated image
|
| 349 |
# The sample.py script saves to logdir/model_name/...
|
|
@@ -368,8 +372,12 @@ def _generate_image_impl(prompt, aspect_ratio, cfg, seed, checkpoint_file, confi
|
|
| 368 |
if output_files:
|
| 369 |
# Get the most recent file
|
| 370 |
latest_file = max(output_files, key=lambda p: p.stat().st_mtime)
|
| 371 |
-
|
| 372 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 373 |
else:
|
| 374 |
# Debug: list what's actually in the directory
|
| 375 |
debug_info = f"\n\nDebug info:\n"
|
|
@@ -392,13 +400,26 @@ def _generate_image_impl(prompt, aspect_ratio, cfg, seed, checkpoint_file, confi
|
|
| 392 |
error_msg += f"\n\nCheck stdout:\n{result.stdout[-1000:] if result.stdout else '(no output)'}"
|
| 393 |
return None, error_msg
|
| 394 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
except Exception as e:
|
| 396 |
# Get full traceback for debugging
|
| 397 |
error_traceback = traceback.format_exc()
|
| 398 |
error_msg = f"β Exception occurred during image generation:\n\n"
|
| 399 |
error_msg += f"Error Type: {type(e).__name__}\n"
|
| 400 |
error_msg += f"Error Message: {str(e)}\n\n"
|
| 401 |
-
error_msg += f"=== FULL TRACEBACK ===\n{error_traceback}\n"
|
|
|
|
|
|
|
| 402 |
return None, error_msg
|
| 403 |
|
| 404 |
|
|
@@ -683,11 +704,12 @@ with gr.Blocks(title="STARFlow - Text-to-Image & Video Generation") as demo:
|
|
| 683 |
)
|
| 684 |
image_status = gr.Textbox(
|
| 685 |
label="π Status",
|
| 686 |
-
lines=
|
| 687 |
-
max_lines=
|
| 688 |
interactive=False,
|
| 689 |
elem_classes="status-box",
|
| 690 |
-
placeholder="Status messages will appear here..."
|
|
|
|
| 691 |
)
|
| 692 |
|
| 693 |
image_btn.click(
|
|
@@ -772,11 +794,12 @@ with gr.Blocks(title="STARFlow - Text-to-Image & Video Generation") as demo:
|
|
| 772 |
)
|
| 773 |
video_status = gr.Textbox(
|
| 774 |
label="π Status",
|
| 775 |
-
lines=
|
| 776 |
-
max_lines=
|
| 777 |
interactive=False,
|
| 778 |
elem_classes="status-box",
|
| 779 |
-
placeholder="Status messages will appear here..."
|
|
|
|
| 780 |
)
|
| 781 |
|
| 782 |
video_btn.click(
|
|
|
|
| 286 |
|
| 287 |
if result.returncode != 0:
|
| 288 |
error_msg = f"β Error during generation (return code: {result.returncode})\n\n"
|
| 289 |
+
error_msg += f"β οΈ IMPORTANT: Scroll down in this status box to see full error details!\n"
|
| 290 |
+
error_msg += f" The error message below contains STDERR, STDOUT, and debugging info.\n\n"
|
| 291 |
|
| 292 |
# Check for GPU abort or CUDA errors
|
| 293 |
error_output = (result.stderr + result.stdout).lower()
|
|
|
|
| 346 |
return None, error_msg
|
| 347 |
|
| 348 |
status_msg += "Generation complete. Looking for output...\n"
|
| 349 |
+
status_msg += f"\nπ‘ Note: Generated images will appear directly in the UI above.\n"
|
| 350 |
+
status_msg += f" The outputs/ folder is runtime-generated and not visible in Files tab.\n\n"
|
| 351 |
|
| 352 |
# Find the generated image
|
| 353 |
# The sample.py script saves to logdir/model_name/...
|
|
|
|
| 372 |
if output_files:
|
| 373 |
# Get the most recent file
|
| 374 |
latest_file = max(output_files, key=lambda p: p.stat().st_mtime)
|
| 375 |
+
# Use absolute path for Gradio to access the file
|
| 376 |
+
image_path = str(latest_file.absolute())
|
| 377 |
+
status_msg += f"β
Found image: {image_path}\n"
|
| 378 |
+
status_msg += f"\nπ‘ Note: Generated images appear directly in the UI above.\n"
|
| 379 |
+
status_msg += f" The outputs/ folder is not visible in Files tab (runtime files).\n"
|
| 380 |
+
return image_path, status_msg + "\nβ
Success! Image generated."
|
| 381 |
else:
|
| 382 |
# Debug: list what's actually in the directory
|
| 383 |
debug_info = f"\n\nDebug info:\n"
|
|
|
|
| 400 |
error_msg += f"\n\nCheck stdout:\n{result.stdout[-1000:] if result.stdout else '(no output)'}"
|
| 401 |
return None, error_msg
|
| 402 |
|
| 403 |
+
except subprocess.TimeoutExpired:
|
| 404 |
+
error_msg = f"β Generation timed out after 45 minutes\n\n"
|
| 405 |
+
error_msg += f"This may indicate:\n"
|
| 406 |
+
error_msg += f"- Model loading is taking too long\n"
|
| 407 |
+
error_msg += f"- GPU timeout (ZeroGPU may have limits)\n"
|
| 408 |
+
error_msg += f"- Process hung or stuck\n\n"
|
| 409 |
+
error_msg += f"Try:\n"
|
| 410 |
+
error_msg += f"- Check Space Logs tab for more details\n"
|
| 411 |
+
error_msg += f"- Try generating again\n"
|
| 412 |
+
error_msg += f"- Check if GPU is still available\n"
|
| 413 |
+
return None, error_msg
|
| 414 |
except Exception as e:
|
| 415 |
# Get full traceback for debugging
|
| 416 |
error_traceback = traceback.format_exc()
|
| 417 |
error_msg = f"β Exception occurred during image generation:\n\n"
|
| 418 |
error_msg += f"Error Type: {type(e).__name__}\n"
|
| 419 |
error_msg += f"Error Message: {str(e)}\n\n"
|
| 420 |
+
error_msg += f"=== FULL TRACEBACK ===\n{error_traceback}\n\n"
|
| 421 |
+
error_msg += f"π‘ TIP: Scroll down in this status box to see full error details.\n"
|
| 422 |
+
error_msg += f" You can also copy the error message using the copy button.\n"
|
| 423 |
return None, error_msg
|
| 424 |
|
| 425 |
|
|
|
|
| 704 |
)
|
| 705 |
image_status = gr.Textbox(
|
| 706 |
label="π Status",
|
| 707 |
+
lines=15,
|
| 708 |
+
max_lines=50,
|
| 709 |
interactive=False,
|
| 710 |
elem_classes="status-box",
|
| 711 |
+
placeholder="Status messages will appear here...",
|
| 712 |
+
show_copy_button=True # Allow copying error messages
|
| 713 |
)
|
| 714 |
|
| 715 |
image_btn.click(
|
|
|
|
| 794 |
)
|
| 795 |
video_status = gr.Textbox(
|
| 796 |
label="π Status",
|
| 797 |
+
lines=15,
|
| 798 |
+
max_lines=50,
|
| 799 |
interactive=False,
|
| 800 |
elem_classes="status-box",
|
| 801 |
+
placeholder="Status messages will appear here...",
|
| 802 |
+
show_copy_button=True # Allow copying error messages
|
| 803 |
)
|
| 804 |
|
| 805 |
video_btn.click(
|