ThomasFfefefef's picture
Update app.py
cbdef19
raw
history blame
946 Bytes
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()