Spaces:
Paused
Paused
Update SwitcherAI/processors/frame/modules/frame_enhancer.py
Browse files
SwitcherAI/processors/frame/modules/frame_enhancer.py
CHANGED
|
@@ -71,15 +71,31 @@ def clear_frame_processor() -> None:
|
|
| 71 |
|
| 72 |
|
| 73 |
def pre_check() -> bool:
|
|
|
|
| 74 |
download_directory_path = resolve_relative_path('../.assets/models')
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
|
| 81 |
def pre_process() -> bool:
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
|
| 85 |
def post_process() -> None:
|
|
|
|
| 71 |
|
| 72 |
|
| 73 |
def pre_check() -> bool:
|
| 74 |
+
"""Download required models for frame enhancement"""
|
| 75 |
download_directory_path = resolve_relative_path('../.assets/models')
|
| 76 |
+
|
| 77 |
+
try:
|
| 78 |
+
conditional_download(download_directory_path, [
|
| 79 |
+
'https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth'
|
| 80 |
+
])
|
| 81 |
+
return True
|
| 82 |
+
except Exception as e:
|
| 83 |
+
print(f"⚠️ Failed to download frame enhancement models: {e}")
|
| 84 |
+
print("🔄 Frame enhancement will be disabled")
|
| 85 |
+
return False
|
| 86 |
|
| 87 |
|
| 88 |
def pre_process() -> bool:
|
| 89 |
+
"""Pre-process check with model validation"""
|
| 90 |
+
try:
|
| 91 |
+
model_path = get_model_config()['real_esrgan_x4']['model_path']
|
| 92 |
+
if not model_path or not model_path.exists():
|
| 93 |
+
print("⚠️ Frame enhancement model not found")
|
| 94 |
+
return False
|
| 95 |
+
return True
|
| 96 |
+
except Exception as e:
|
| 97 |
+
print(f"⚠️ Frame enhancement pre-process failed: {e}")
|
| 98 |
+
return False
|
| 99 |
|
| 100 |
|
| 101 |
def post_process() -> None:
|