Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,22 +52,27 @@ class EnhancedVideoGenerator:
|
|
| 52 |
def initialize_models(self):
|
| 53 |
"""Initialize all AI models"""
|
| 54 |
try:
|
| 55 |
-
# Text generation model
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
except Exception as e:
|
| 69 |
self.logger.error(f"Model initialization failed: {str(e)}")
|
| 70 |
-
raise
|
|
|
|
| 71 |
|
| 72 |
def setup_workspace(self):
|
| 73 |
"""Set up working directory and resources"""
|
|
|
|
| 52 |
def initialize_models(self):
|
| 53 |
"""Initialize all AI models"""
|
| 54 |
try:
|
| 55 |
+
# Text generation model initialization with error handling
|
| 56 |
+
try:
|
| 57 |
+
self.text_generator = pipeline(
|
| 58 |
+
'text-generation',
|
| 59 |
+
model='gpt2',
|
| 60 |
+
device=0 if self.device == "cuda" else -1
|
| 61 |
+
)
|
| 62 |
+
except Exception as e:
|
| 63 |
+
self.logger.warning(f"Text generator initialization failed: {str(e)}")
|
| 64 |
+
self.text_generator = None
|
| 65 |
+
|
| 66 |
+
# Skip the StableDiffusion model initialization as it requires additional setup
|
| 67 |
+
self.image_model = None
|
| 68 |
+
|
| 69 |
+
# Initialize stability API attribute
|
| 70 |
+
self.stability_api = None
|
| 71 |
+
|
| 72 |
except Exception as e:
|
| 73 |
self.logger.error(f"Model initialization failed: {str(e)}")
|
| 74 |
+
# Don't raise exception, allow initialization with degraded functionality
|
| 75 |
+
pass
|
| 76 |
|
| 77 |
def setup_workspace(self):
|
| 78 |
"""Set up working directory and resources"""
|