import gradio as gr import os from moviepy.editor import * def replay(option): path = "" # Get the correct model if (option == "LunarLander-v2 🚀👩‍🚀"): path = "./LunarLander-v2.mp4" elif(option == "CartPole-v1 🕹ī¸"): path = "./CartPole-v1.mp4" elif(option == "Atari Space Invaders 👾"): path = "./SpaceInvadersNoFrameskip-v4.mp4" # The only turnaround I found (Base64 video pb) videoclip = VideoFileClip(path) videoclip.write_videofile("new_filename.mp4") return 'new_filename.mp4' """ TODO: Next version with live video generation def replay_classical(hf_model_filename, hf_model_id): import gym from stable_baselines3 import PPO from stable_baselines3.common.evaluation import evaluate_policy model = PPO.load_from_huggingface(hf_model_id,hf_model_filename) eval_env = gym.make(option) def replay_atari(hf_model_filename, hf_model_id): """ iface = gr.Interface( replay, [ gr.inputs.Dropdown(["Atari Space Invaders 👾", "CartPole-v1 🕹ī¸", "LunarLander-v2 🚀👩‍🚀"]), ], "video", title = 'Stable Baselines 3 with 🤗', description = '', article = '''

This version of the RL library allows you to load models directly from the Hugging Face Hub

Select the trained agent you want to watch perform. These models are from Stable Baseline Zoo

There are currently 3 models:

''' ) iface.launch()