ThomasSimonini HF staff commited on
Commit
8bf192d
1 Parent(s): 91cb2a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -105,7 +105,7 @@ def check_if_passed(model):
105
  if model["best_result"] >= model["min_result"]:
106
  model["passed"] = True
107
 
108
- def test_(hf_username):
109
  results_certification = [
110
  {
111
  "unit": "Unit 1",
@@ -198,7 +198,7 @@ def test_(hf_username):
198
  "passed": False
199
  },
200
  {
201
- "unit": "Unit 8 Part 1",
202
  "env": "GodotRL-JumperHard",
203
  "library": "cleanrl",
204
  "min_result": -100,
@@ -207,7 +207,7 @@ def test_(hf_username):
207
  "passed": False
208
  },
209
  {
210
- "unit": "Unit 8 Part 2",
211
  "env": "Vizdoom-Battle",
212
  "library": "cleanrl",
213
  "min_result": -100,
@@ -219,7 +219,7 @@ def test_(hf_username):
219
  for unit in results_certification:
220
  # Get user model
221
  user_models = get_user_models(hf_username, unit['env'], unit['library'])
222
- print(user_models)
223
  # Calculate the best result and get the best_model_id
224
  best_result, best_model_id = calculate_best_result(user_models)
225
 
@@ -233,8 +233,8 @@ def test_(hf_username):
233
 
234
  print(results_certification)
235
 
236
- df = pd.DataFrame (results_certification)
237
-
238
  return df
239
 
240
 
@@ -256,7 +256,7 @@ with gr.Blocks() as demo:
256
  hf_username = gr.Textbox(placeholder="ThomasSimonini", label="Your Hugging Face Username")
257
  #email = gr.Textbox(placeholder="thomas.simonini@huggingface.co", label="Your Email (to receive your certificate)")
258
  check_progress_button = gr.Button(value="Check my progress")
259
- output = gr.components.Dataframe(value= test_(hf_username), headers=["Unit", "Environment", "Library", "Baseline", "Your best result", "Your best model id", "Pass?"], datatype=["markdown", "markdown", "markdown", "number", "number", "markdown", "bool"])
260
  check_progress_button.click(fn=test_, inputs=hf_username, outputs=output)
261
 
262
  demo.launch()
 
105
  if model["best_result"] >= model["min_result"]:
106
  model["passed"] = True
107
 
108
+ def certification(hf_username):
109
  results_certification = [
110
  {
111
  "unit": "Unit 1",
 
198
  "passed": False
199
  },
200
  {
201
+ "unit": "Unit 8 PI",
202
  "env": "GodotRL-JumperHard",
203
  "library": "cleanrl",
204
  "min_result": -100,
 
207
  "passed": False
208
  },
209
  {
210
+ "unit": "Unit 8 PII",
211
  "env": "Vizdoom-Battle",
212
  "library": "cleanrl",
213
  "min_result": -100,
 
219
  for unit in results_certification:
220
  # Get user model
221
  user_models = get_user_models(hf_username, unit['env'], unit['library'])
222
+
223
  # Calculate the best result and get the best_model_id
224
  best_result, best_model_id = calculate_best_result(user_models)
225
 
 
233
 
234
  print(results_certification)
235
 
236
+ df = pd.DataFrame(results_certification)
237
+ df = df[['passed', 'unit1', 'env', 'min_result', 'best_result', 'best_model_id']]
238
  return df
239
 
240
 
 
256
  hf_username = gr.Textbox(placeholder="ThomasSimonini", label="Your Hugging Face Username")
257
  #email = gr.Textbox(placeholder="thomas.simonini@huggingface.co", label="Your Email (to receive your certificate)")
258
  check_progress_button = gr.Button(value="Check my progress")
259
+ output = gr.components.Dataframe(value= certification(hf_username), headers=["Unit", "Environment", "Library", "Baseline", "Your best result", "Your best model id", "Pass?"], datatype=["markdown", "markdown", "markdown", "number", "number", "markdown", "bool"])
260
  check_progress_button.click(fn=test_, inputs=hf_username, outputs=output)
261
 
262
  demo.launch()