sourize
commited on
Commit
·
46f75eb
1
Parent(s):
5535d80
Updated Code
Browse files- utils/prompt_manager.py +4 -0
- utils/renderer.py +4 -4
utils/prompt_manager.py
CHANGED
|
@@ -169,6 +169,7 @@ Requirements:
|
|
| 169 |
8. Include comments explaining key parts
|
| 170 |
9. Keep animations under {ANIMATION_CONSTANTS['MAX_DURATION']} seconds total duration
|
| 171 |
10. Use appropriate wait times between animations (between {ANIMATION_CONSTANTS['MIN_WAIT_TIME']} and {ANIMATION_CONSTANTS['MAX_WAIT_TIME']} seconds)
|
|
|
|
| 172 |
|
| 173 |
Structure:
|
| 174 |
```python
|
|
@@ -176,6 +177,9 @@ from manim import *
|
|
| 176 |
|
| 177 |
class GeneratedScene(Scene):
|
| 178 |
def construct(self):
|
|
|
|
|
|
|
|
|
|
| 179 |
# Your animation code here
|
| 180 |
pass
|
| 181 |
```
|
|
|
|
| 169 |
8. Include comments explaining key parts
|
| 170 |
9. Keep animations under {ANIMATION_CONSTANTS['MAX_DURATION']} seconds total duration
|
| 171 |
10. Use appropriate wait times between animations (between {ANIMATION_CONSTANTS['MIN_WAIT_TIME']} and {ANIMATION_CONSTANTS['MAX_WAIT_TIME']} seconds)
|
| 172 |
+
11. To set background color, use: self.camera.background_color = WHITE
|
| 173 |
|
| 174 |
Structure:
|
| 175 |
```python
|
|
|
|
| 177 |
|
| 178 |
class GeneratedScene(Scene):
|
| 179 |
def construct(self):
|
| 180 |
+
# Set background color
|
| 181 |
+
self.camera.background_color = WHITE
|
| 182 |
+
|
| 183 |
# Your animation code here
|
| 184 |
pass
|
| 185 |
```
|
utils/renderer.py
CHANGED
|
@@ -112,20 +112,20 @@ class VideoRenderer:
|
|
| 112 |
return True, video_file, process.stdout
|
| 113 |
else:
|
| 114 |
self._record_metrics(False, "NoVideoFile")
|
| 115 |
-
return False, "
|
| 116 |
else:
|
| 117 |
self._record_metrics(False, "RenderingFailed")
|
| 118 |
-
return False,
|
| 119 |
|
| 120 |
except subprocess.TimeoutExpired:
|
| 121 |
self._record_metrics(False, "TimeoutError")
|
| 122 |
-
return False, "Rendering
|
| 123 |
|
| 124 |
except Exception as e:
|
| 125 |
logger.error(f"Error rendering video: {e}")
|
| 126 |
self._record_metrics(False, "RenderingError")
|
| 127 |
ErrorHandler.handle_error(ErrorType.RENDERING_ERROR, str(e))
|
| 128 |
-
return False,
|
| 129 |
|
| 130 |
@property
|
| 131 |
def estimated_render_time(self) -> int:
|
|
|
|
| 112 |
return True, video_file, process.stdout
|
| 113 |
else:
|
| 114 |
self._record_metrics(False, "NoVideoFile")
|
| 115 |
+
return False, "Rendering completed but no video file was found", ""
|
| 116 |
else:
|
| 117 |
self._record_metrics(False, "RenderingFailed")
|
| 118 |
+
return False, "Rendering failed. Please check your scene code.", ""
|
| 119 |
|
| 120 |
except subprocess.TimeoutExpired:
|
| 121 |
self._record_metrics(False, "TimeoutError")
|
| 122 |
+
return False, "Rendering took too long and was stopped", ""
|
| 123 |
|
| 124 |
except Exception as e:
|
| 125 |
logger.error(f"Error rendering video: {e}")
|
| 126 |
self._record_metrics(False, "RenderingError")
|
| 127 |
ErrorHandler.handle_error(ErrorType.RENDERING_ERROR, str(e))
|
| 128 |
+
return False, "An error occurred during rendering", ""
|
| 129 |
|
| 130 |
@property
|
| 131 |
def estimated_render_time(self) -> int:
|