Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| def replay(name): | |
| # Get the correct model | |
| if (option == "LunarLander-v2 ππ©βπ"): | |
| return "./LunarLander-v2.mp4" | |
| elif(option == "CartPole-v1 πΉοΈ"): | |
| return "./CartPole-v1.mp4" | |
| elif(option == "Atari Space Invaders πΎ"): | |
| return "./SpaceInvadersNoFrameskip-v4.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(fn=, inputs="dropdown", outputs="text") | |
| iface = gr.Interface( | |
| replay, | |
| [ | |
| gr.inputs.Dropdown(["Atari Space Invaders πΎ", "CartPole-v1 πΉοΈ", "LunarLander-v2 ππ©βπ "]), | |
| ], | |
| "video" | |
| ) | |
| iface.launch() |