Spaces:
Runtime error
Runtime error
Thomas Simonini
commited on
Commit
·
9e97c8e
1
Parent(s):
b72ce67
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,8 @@ from stable_baselines3.common.vec_env import VecFrameStack
|
|
| 12 |
from stable_baselines3.common.vec_env import VecVideoRecorder, DummyVecEnv
|
| 13 |
from stable_baselines3.common.evaluation import evaluate_policy
|
| 14 |
|
|
|
|
|
|
|
| 15 |
def replay(model_id, filename, environment, evaluate):
|
| 16 |
# Load the model
|
| 17 |
checkpoint = load_from_hub(model_id, filename)
|
|
@@ -49,7 +51,11 @@ def replay(model_id, filename, environment, evaluate):
|
|
| 49 |
print(type(results))
|
| 50 |
print(env)
|
| 51 |
print(env.video_recorder.path)
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
|
| 55 |
iface = gr.Interface(fn=replay, inputs=[
|
|
|
|
| 12 |
from stable_baselines3.common.vec_env import VecVideoRecorder, DummyVecEnv
|
| 13 |
from stable_baselines3.common.evaluation import evaluate_policy
|
| 14 |
|
| 15 |
+
from moviepy.editor import *
|
| 16 |
+
|
| 17 |
def replay(model_id, filename, environment, evaluate):
|
| 18 |
# Load the model
|
| 19 |
checkpoint = load_from_hub(model_id, filename)
|
|
|
|
| 51 |
print(type(results))
|
| 52 |
print(env)
|
| 53 |
print(env.video_recorder.path)
|
| 54 |
+
|
| 55 |
+
videoclip = VideoFileClip(env.video_recorder.path)
|
| 56 |
+
videoclip.write_videofile("new_filename.mp4")
|
| 57 |
+
return 'new_filename.mp4'
|
| 58 |
+
|
| 59 |
|
| 60 |
|
| 61 |
iface = gr.Interface(fn=replay, inputs=[
|