Spaces:
Sleeping
Sleeping
up
Browse files
crazy_functions/数学动画生成manim.py
CHANGED
|
@@ -33,15 +33,15 @@ def eval_manim(code):
|
|
| 33 |
try:
|
| 34 |
subprocess.check_output([sys.executable, '-c', f"from gpt_log.MyAnimation import {class_name}; {class_name}().render()"])
|
| 35 |
shutil.copyfile('media/videos/1080p60/MyAnimation.mp4', f'gpt_log/{gen_time_str()}.mp4')
|
|
|
|
| 36 |
except subprocess.CalledProcessError as e:
|
| 37 |
output = e.output.decode()
|
| 38 |
-
print(f"Command returned non-zero exit status {e.returncode}: {output}")
|
| 39 |
-
return "Evaluating python script failed"
|
| 40 |
except:
|
| 41 |
print('generating mp4 failed')
|
| 42 |
-
return "Generating mp4 failed"
|
| 43 |
|
| 44 |
-
return f'gpt_log/{gen_time_str()}.mp4'
|
| 45 |
|
| 46 |
def get_code_block(reply):
|
| 47 |
import re
|
|
|
|
| 33 |
try:
|
| 34 |
subprocess.check_output([sys.executable, '-c', f"from gpt_log.MyAnimation import {class_name}; {class_name}().render()"])
|
| 35 |
shutil.copyfile('media/videos/1080p60/MyAnimation.mp4', f'gpt_log/{gen_time_str()}.mp4')
|
| 36 |
+
return f'gpt_log/{gen_time_str()}.mp4'
|
| 37 |
except subprocess.CalledProcessError as e:
|
| 38 |
output = e.output.decode()
|
| 39 |
+
print(f"Command returned non-zero exit status {e.returncode}: {output}.")
|
| 40 |
+
return f"Evaluating python script failed: {e.output}."
|
| 41 |
except:
|
| 42 |
print('generating mp4 failed')
|
| 43 |
+
return "Generating mp4 failed."
|
| 44 |
|
|
|
|
| 45 |
|
| 46 |
def get_code_block(reply):
|
| 47 |
import re
|