| | |
| | """ |
| | Quick fix script to run comic generation with memory-safe settings |
| | """ |
| |
|
| | import os |
| | import sys |
| |
|
| | |
| | os.environ['CUDA_VISIBLE_DEVICES'] = '0' |
| | os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True' |
| | os.environ['USE_AI_MODELS'] = '1' |
| | os.environ['ENHANCE_FACES'] = '0' |
| |
|
| | |
| | import torch |
| | if torch.cuda.is_available(): |
| | torch.cuda.set_per_process_memory_fraction(0.4) |
| |
|
| | |
| | from app_enhanced import app, EnhancedComicGenerator |
| |
|
| | def generate_comic_safe(video_path='video/uploaded.mp4'): |
| | """Generate comic with memory safety""" |
| | print("π Starting memory-safe comic generation...") |
| | print(f"π GPU Memory limit: 40% of available VRAM") |
| | |
| | try: |
| | generator = EnhancedComicGenerator() |
| | generator.video_path = video_path |
| | |
| | |
| | generator.quality_mode = '0' |
| | generator.ai_mode = '1' |
| | |
| | |
| | result = generator.generate_comic() |
| | |
| | print("β
Comic generation complete!") |
| | return result |
| | |
| | except Exception as e: |
| | print(f"β Generation failed: {e}") |
| | return False |
| |
|
| | if __name__ == "__main__": |
| | |
| | if len(sys.argv) > 1: |
| | video_path = sys.argv[1] |
| | else: |
| | video_path = 'video/uploaded.mp4' |
| | |
| | generate_comic_safe(video_path) |