ThomasFfefefef commited on
Commit
f3feb7a
Β·
1 Parent(s): 318c231

Update app.py

Browse files

Test the new version of the app with a video selector.

Files changed (1) hide show
  1. app.py +36 -3
app.py CHANGED
@@ -1,7 +1,40 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
  iface.launch()
 
1
  import gradio as gr
2
 
3
+ def replay(name):
4
+ # Get the correct model
5
+ if (option == "LunarLander-v2 πŸš€πŸ‘©β€πŸš€"):
6
+ return "./LunarLander-v2.mp4"
7
+ elif(option == "CartPole-v1 πŸ•ΉοΈ"):
8
+ return "./CartPole-v1.mp4"
9
+ elif(option == "Atari Space Invaders πŸ‘Ύ")
10
+ return "./SpaceInvadersNoFrameskip-v4.mp4"
11
+
12
+ """
13
+ TODO: Next version with live video generation
14
+ def replay_classical(hf_model_filename, hf_model_id):
15
+ import gym
16
+ from stable_baselines3 import PPO
17
+ from stable_baselines3.common.evaluation import evaluate_policy
18
+
19
+ model = PPO.load_from_huggingface(hf_model_id,hf_model_filename)
20
+
21
+ eval_env = gym.make(option)
22
+
23
+
24
+ def replay_atari(hf_model_filename, hf_model_id):
25
+ """
26
+
27
+ #iface = gr.Interface(fn=, inputs="dropdown", outputs="text")
28
+
29
+
30
+
31
+ iface = gr.Interface(
32
+ replay,
33
+ [
34
+ gr.inputs.Dropdown(["Atari Space Invaders πŸ‘Ύ", "CartPole-v1 πŸ•ΉοΈ", "LunarLander-v2 πŸš€πŸ‘©β€πŸš€ "]),
35
+ ],
36
+ "playable_video"
37
+
38
+ )
39
 
 
40
  iface.launch()