Spaces:
Sleeping
Sleeping
Update app.py from anycoder
Browse files
app.py
CHANGED
|
@@ -5,10 +5,17 @@ import time
|
|
| 5 |
import sys
|
| 6 |
from pathlib import Path
|
| 7 |
|
| 8 |
-
# Ensure local modules are prioritized over system packages
|
| 9 |
# This prevents ImportError when a 'utils' package exists in site-packages
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
from utils import WANVideoGenerator, LoRAManager, NSFWChecker
|
| 13 |
from config import MODEL_CONFIGS, AVAILABLE_LORAS, NSFW_CONFIG
|
| 14 |
|
|
|
|
| 5 |
import sys
|
| 6 |
from pathlib import Path
|
| 7 |
|
| 8 |
+
# CRITICAL FIX: Ensure local modules are prioritized over system packages
|
| 9 |
# This prevents ImportError when a 'utils' package exists in site-packages
|
| 10 |
+
current_dir = Path(__file__).resolve().parent
|
| 11 |
+
if str(current_dir) not in sys.path:
|
| 12 |
+
sys.path.insert(0, str(current_dir))
|
| 13 |
|
| 14 |
+
# Clear any cached utils module to force reimport from local file
|
| 15 |
+
if 'utils' in sys.modules:
|
| 16 |
+
del sys.modules['utils']
|
| 17 |
+
|
| 18 |
+
# Now import from the local utils.py file
|
| 19 |
from utils import WANVideoGenerator, LoRAManager, NSFWChecker
|
| 20 |
from config import MODEL_CONFIGS, AVAILABLE_LORAS, NSFW_CONFIG
|
| 21 |
|