#!/usr/bin/env python3 """ Setup script for integrating BMO MiniMax-Remover into ComfyUI This script helps you copy the necessary files to your ComfyUI installation """ import os import shutil import sys from pathlib import Path def main(): print("šŸš€ MiniMax-Remover BMO ComfyUI Integration Setup") print("=" * 60) # Current directory (where this script is located) current_dir = Path(__file__).parent # Find ComfyUI directory comfyui_path = None # Common ComfyUI locations possible_paths = [ Path.home() / "ComfyUI", Path("../ComfyUI"), Path("../../ComfyUI"), Path("C:/ComfyUI"), Path("/opt/ComfyUI"), ] # Ask user for ComfyUI path print("Please enter your ComfyUI installation path:") print("(or press Enter to auto-detect)") user_path = input("ComfyUI path: ").strip() if user_path: comfyui_path = Path(user_path) else: # Try to auto-detect for path in possible_paths: if path.exists() and (path / "main.py").exists(): comfyui_path = path print(f"šŸ“ Auto-detected ComfyUI at: {comfyui_path}") break if not comfyui_path or not comfyui_path.exists(): print("āŒ ComfyUI path not found. Please specify the correct path.") return False # Check if it's a valid ComfyUI installation if not (comfyui_path / "main.py").exists(): print("āŒ Invalid ComfyUI installation (main.py not found)") return False # Create custom_nodes directory if it doesn't exist custom_nodes_dir = comfyui_path / "custom_nodes" / "minimax-remover-bmo" custom_nodes_dir.mkdir(parents=True, exist_ok=True) print(f"šŸ“ Target directory: {custom_nodes_dir}") # Files to copy files_to_copy = [ "pipeline_minimax_remover_bmo.py", "minimax_mask_node_bmo.py", "transformer_minimax_remover.py", "__init___bmo.py", "requirements_bmo.txt" ] # Copy files print("\nšŸ“‹ Copying files...") for file_name in files_to_copy: src_file = current_dir / file_name dst_file = custom_nodes_dir / file_name if src_file.exists(): # Special handling for __init___bmo.py -> __init__.py if file_name == "__init___bmo.py": dst_file = custom_nodes_dir / "__init__.py" # Special handling for requirements_bmo.txt -> requirements.txt elif file_name == "requirements_bmo.txt": dst_file = custom_nodes_dir / "requirements.txt" shutil.copy2(src_file, dst_file) print(f"āœ… Copied: {file_name} -> {dst_file.name}") else: print(f"āš ļø Warning: {file_name} not found in current directory") print("āœ… All BMO files copied successfully!") # Create installation instructions instructions = f""" šŸŽ‰ BMO MiniMax-Remover Integration Complete! šŸ“ Installation Location: {custom_nodes_dir} šŸ“‹ Next Steps: 1. Restart ComfyUI completely 2. Look for the new nodes in the "MiniMax-Remover" category: - "MiniMax-Remover (BMO)" - Main processing node - "MiniMax-Remover Loader (BMO)" - Model loader node šŸ”§ Model Setup: - Place your MiniMax-Remover models in: {comfyui_path}/models/ - Expected structure: models/ ā”œā”€ā”€ vae/ ā”œā”€ā”€ transformer/ └── scheduler/ šŸš€ Usage: 1. Load your video frames as IMAGE 2. Load your masks as MASK 3. Connect to the "MiniMax-Remover (BMO)" node 4. Set parameters: - num_inference_steps: 12 (official default) - iterations: 6 (official default) - seed: Any number for reproducible results ✨ Key Features: - Proper VAE normalization for natural results - Correct dimension handling - Official MiniMax parameters - Clean, efficient processing - Fast performance (1-2 seconds) šŸŽÆ The BMO pipeline delivers natural, high-quality inpainting results! """ print(instructions) # Save instructions to file with open(custom_nodes_dir / "INSTALLATION_COMPLETE.txt", "w") as f: f.write(instructions) print(f"šŸ’¾ Instructions saved to: {custom_nodes_dir / 'INSTALLATION_COMPLETE.txt'}") return True if __name__ == "__main__": success = main() if success: print("\nšŸŽ‰ Setup completed successfully!") print("Please restart ComfyUI to see the new nodes.") else: print("\nāŒ Setup failed. Please check the errors above.") sys.exit(1)