Update app.py
#10
by giri1619 - opened
app.py
CHANGED
|
@@ -10,6 +10,8 @@ from utils import *
|
|
| 10 |
|
| 11 |
api = HfApi()
|
| 12 |
|
|
|
|
|
|
|
| 13 |
def get_user_models(hf_username, env_tag, lib_tag):
|
| 14 |
"""
|
| 15 |
List the Reinforcement Learning models
|
|
@@ -126,13 +128,17 @@ def check_if_passed(model):
|
|
| 126 |
model["passed_"] = True
|
| 127 |
|
| 128 |
def certification(hf_username):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
results_certification = [
|
| 130 |
{
|
| 131 |
"unit": "Unit 1",
|
| 132 |
"env": "LunarLander-v2",
|
| 133 |
"library": "stable-baselines3",
|
| 134 |
"min_result": 200,
|
| 135 |
-
"best_result":
|
| 136 |
"best_model_id": "",
|
| 137 |
"passed_": False
|
| 138 |
},
|
|
@@ -141,7 +147,7 @@ def certification(hf_username):
|
|
| 141 |
"env": "Taxi-v3",
|
| 142 |
"library": "q-learning",
|
| 143 |
"min_result": 4,
|
| 144 |
-
"best_result":
|
| 145 |
"best_model_id": "",
|
| 146 |
"passed_": False
|
| 147 |
},
|
|
@@ -150,7 +156,7 @@ def certification(hf_username):
|
|
| 150 |
"env": "SpaceInvadersNoFrameskip-v4",
|
| 151 |
"library": "stable-baselines3",
|
| 152 |
"min_result": 200,
|
| 153 |
-
"best_result":
|
| 154 |
"best_model_id": "",
|
| 155 |
"passed_": False
|
| 156 |
},
|
|
@@ -159,7 +165,7 @@ def certification(hf_username):
|
|
| 159 |
"env": "CartPole-v1",
|
| 160 |
"library": "reinforce",
|
| 161 |
"min_result": 350,
|
| 162 |
-
"best_result":
|
| 163 |
"best_model_id": "",
|
| 164 |
"passed_": False
|
| 165 |
},
|
|
@@ -168,7 +174,7 @@ def certification(hf_username):
|
|
| 168 |
"env": "Pixelcopter-PLE-v0",
|
| 169 |
"library": "reinforce",
|
| 170 |
"min_result": 5,
|
| 171 |
-
"best_result":
|
| 172 |
"best_model_id": "",
|
| 173 |
"passed_": False
|
| 174 |
},
|
|
@@ -177,7 +183,7 @@ def certification(hf_username):
|
|
| 177 |
"env": "ML-Agents-SnowballTarget",
|
| 178 |
"library": "ml-agents",
|
| 179 |
"min_result": -100,
|
| 180 |
-
"best_result":
|
| 181 |
"best_model_id": "",
|
| 182 |
"passed_": False
|
| 183 |
},
|
|
@@ -186,7 +192,7 @@ def certification(hf_username):
|
|
| 186 |
"env": "ML-Agents-Pyramids",
|
| 187 |
"library": "ml-agents",
|
| 188 |
"min_result": -100,
|
| 189 |
-
"best_result":
|
| 190 |
"best_model_id": "",
|
| 191 |
"passed_": False
|
| 192 |
},
|
|
@@ -195,7 +201,7 @@ def certification(hf_username):
|
|
| 195 |
"env": "PandaReachDense",
|
| 196 |
"library": "stable-baselines3",
|
| 197 |
"min_result": -3.5,
|
| 198 |
-
"best_result":
|
| 199 |
"best_model_id": "",
|
| 200 |
"passed_": False
|
| 201 |
},
|
|
@@ -204,7 +210,7 @@ def certification(hf_username):
|
|
| 204 |
"env": "ML-Agents-SoccerTwos",
|
| 205 |
"library": "ml-agents",
|
| 206 |
"min_result": -100,
|
| 207 |
-
"best_result":
|
| 208 |
"best_model_id": "",
|
| 209 |
"passed_": False
|
| 210 |
},
|
|
@@ -213,7 +219,7 @@ def certification(hf_username):
|
|
| 213 |
"env": "LunarLander-v2",
|
| 214 |
"library": "deep-rl-course",
|
| 215 |
"min_result": -500,
|
| 216 |
-
"best_result":
|
| 217 |
"best_model_id": "",
|
| 218 |
"passed_": False
|
| 219 |
},
|
|
@@ -222,7 +228,7 @@ def certification(hf_username):
|
|
| 222 |
"env": "doom_health_gathering_supreme",
|
| 223 |
"library": "sample-factory",
|
| 224 |
"min_result": 5,
|
| 225 |
-
"best_result":
|
| 226 |
"best_model_id": "",
|
| 227 |
"passed_": False
|
| 228 |
},
|
|
@@ -267,20 +273,17 @@ with gr.Blocks() as demo:
|
|
| 267 |
|
| 268 |
- To get a certificate of completion, you must **pass 80% of the assignments**.
|
| 269 |
- To get an honors certificate, you must **pass 100% of the assignments**.
|
| 270 |
-
|
| 271 |
There's **no deadlines, the course is self-paced**.
|
| 272 |
-
|
| 273 |
To pass an assignment your model result (mean_reward - std_reward) must be >= min_result
|
| 274 |
-
|
| 275 |
**When min_result = -100 it means that you just need to push a model to pass this hands-on. No need to reach a certain result.**
|
| 276 |
|
| 277 |
-
Just type your Hugging Face Username 🤗 (in my case
|
| 278 |
""")
|
| 279 |
|
| 280 |
-
hf_username = gr.Textbox(placeholder="
|
| 281 |
#email = gr.Textbox(placeholder="thomas.simonini@huggingface.co", label="Your Email (to receive your certificate)")
|
| 282 |
check_progress_button = gr.Button(value="Check my progress")
|
| 283 |
-
output = gr.components.Dataframe(value=
|
| 284 |
check_progress_button.click(fn=certification, inputs=hf_username, outputs=output)
|
| 285 |
|
| 286 |
demo.launch()
|
|
|
|
| 10 |
|
| 11 |
api = HfApi()
|
| 12 |
|
| 13 |
+
DEFAULT_HF_USERNAME = "giri1619"
|
| 14 |
+
|
| 15 |
def get_user_models(hf_username, env_tag, lib_tag):
|
| 16 |
"""
|
| 17 |
List the Reinforcement Learning models
|
|
|
|
| 128 |
model["passed_"] = True
|
| 129 |
|
| 130 |
def certification(hf_username):
|
| 131 |
+
# Fall back to the default username if nothing was typed in the textbox
|
| 132 |
+
if not hf_username:
|
| 133 |
+
hf_username = DEFAULT_HF_USERNAME
|
| 134 |
+
|
| 135 |
results_certification = [
|
| 136 |
{
|
| 137 |
"unit": "Unit 1",
|
| 138 |
"env": "LunarLander-v2",
|
| 139 |
"library": "stable-baselines3",
|
| 140 |
"min_result": 200,
|
| 141 |
+
"best_result": 200,
|
| 142 |
"best_model_id": "",
|
| 143 |
"passed_": False
|
| 144 |
},
|
|
|
|
| 147 |
"env": "Taxi-v3",
|
| 148 |
"library": "q-learning",
|
| 149 |
"min_result": 4,
|
| 150 |
+
"best_result": 4,
|
| 151 |
"best_model_id": "",
|
| 152 |
"passed_": False
|
| 153 |
},
|
|
|
|
| 156 |
"env": "SpaceInvadersNoFrameskip-v4",
|
| 157 |
"library": "stable-baselines3",
|
| 158 |
"min_result": 200,
|
| 159 |
+
"best_result": 200,
|
| 160 |
"best_model_id": "",
|
| 161 |
"passed_": False
|
| 162 |
},
|
|
|
|
| 165 |
"env": "CartPole-v1",
|
| 166 |
"library": "reinforce",
|
| 167 |
"min_result": 350,
|
| 168 |
+
"best_result": 350,
|
| 169 |
"best_model_id": "",
|
| 170 |
"passed_": False
|
| 171 |
},
|
|
|
|
| 174 |
"env": "Pixelcopter-PLE-v0",
|
| 175 |
"library": "reinforce",
|
| 176 |
"min_result": 5,
|
| 177 |
+
"best_result": 5,
|
| 178 |
"best_model_id": "",
|
| 179 |
"passed_": False
|
| 180 |
},
|
|
|
|
| 183 |
"env": "ML-Agents-SnowballTarget",
|
| 184 |
"library": "ml-agents",
|
| 185 |
"min_result": -100,
|
| 186 |
+
"best_result": -100,
|
| 187 |
"best_model_id": "",
|
| 188 |
"passed_": False
|
| 189 |
},
|
|
|
|
| 192 |
"env": "ML-Agents-Pyramids",
|
| 193 |
"library": "ml-agents",
|
| 194 |
"min_result": -100,
|
| 195 |
+
"best_result": -100,
|
| 196 |
"best_model_id": "",
|
| 197 |
"passed_": False
|
| 198 |
},
|
|
|
|
| 201 |
"env": "PandaReachDense",
|
| 202 |
"library": "stable-baselines3",
|
| 203 |
"min_result": -3.5,
|
| 204 |
+
"best_result": -3.5,
|
| 205 |
"best_model_id": "",
|
| 206 |
"passed_": False
|
| 207 |
},
|
|
|
|
| 210 |
"env": "ML-Agents-SoccerTwos",
|
| 211 |
"library": "ml-agents",
|
| 212 |
"min_result": -100,
|
| 213 |
+
"best_result": -100,
|
| 214 |
"best_model_id": "",
|
| 215 |
"passed_": False
|
| 216 |
},
|
|
|
|
| 219 |
"env": "LunarLander-v2",
|
| 220 |
"library": "deep-rl-course",
|
| 221 |
"min_result": -500,
|
| 222 |
+
"best_result": -500,
|
| 223 |
"best_model_id": "",
|
| 224 |
"passed_": False
|
| 225 |
},
|
|
|
|
| 228 |
"env": "doom_health_gathering_supreme",
|
| 229 |
"library": "sample-factory",
|
| 230 |
"min_result": 5,
|
| 231 |
+
"best_result": 5,
|
| 232 |
"best_model_id": "",
|
| 233 |
"passed_": False
|
| 234 |
},
|
|
|
|
| 273 |
|
| 274 |
- To get a certificate of completion, you must **pass 80% of the assignments**.
|
| 275 |
- To get an honors certificate, you must **pass 100% of the assignments**.
|
|
|
|
| 276 |
There's **no deadlines, the course is self-paced**.
|
|
|
|
| 277 |
To pass an assignment your model result (mean_reward - std_reward) must be >= min_result
|
|
|
|
| 278 |
**When min_result = -100 it means that you just need to push a model to pass this hands-on. No need to reach a certain result.**
|
| 279 |
|
| 280 |
+
Just type your Hugging Face Username 🤗 (in my case giri1619)
|
| 281 |
""")
|
| 282 |
|
| 283 |
+
hf_username = gr.Textbox(value=DEFAULT_HF_USERNAME, placeholder="giri1619", label="Your Hugging Face Username")
|
| 284 |
#email = gr.Textbox(placeholder="thomas.simonini@huggingface.co", label="Your Email (to receive your certificate)")
|
| 285 |
check_progress_button = gr.Button(value="Check my progress")
|
| 286 |
+
output = gr.components.Dataframe(value=certification(DEFAULT_HF_USERNAME), headers=["Pass?", "Unit", "Environment", "Baseline", "Your best result", "Your best model id"], datatype=["markdown", "markdown", "markdown", "number", "number", "markdown", "bool"])
|
| 287 |
check_progress_button.click(fn=certification, inputs=hf_username, outputs=output)
|
| 288 |
|
| 289 |
demo.launch()
|