ThomasSimonini HF staff commited on
Commit
4d81439
Β·
1 Parent(s): 3a485e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -13
app.py CHANGED
@@ -259,7 +259,7 @@ def certification(hf_username, first_name, last_name):
259
 
260
 
261
 
262
- return message, pdf, certificate, df, output_row.update(visible=True)
263
 
264
  """
265
  Verify that the user pass.
@@ -291,8 +291,10 @@ def verify_certification(df, hf_username, first_name, last_name):
291
 
292
  # Add a message
293
  message = """
294
- Congratulations, you successfully completed the Hugging Face Deep Reinforcement Learning Course πŸŽ‰ \n
295
- **Since you pass 100% of the hands-on you get a Certificate of Excellence πŸŽ“.**
 
 
296
  """
297
 
298
  elif pass_percentage < 100 and pass_percentage >= 80:
@@ -304,9 +306,11 @@ def verify_certification(df, hf_username, first_name, last_name):
304
 
305
  # Add a message
306
  message = """
307
- Congratulations, you successfully completed the Hugging Face Deep Reinforcement Learning Course πŸŽ‰ \n
308
- **Since you pass 80% of the hands-on you get a Certificate of Completion πŸŽ“**. You can try to get a Certificate of Excellence
309
- if you pass 100% of the hands-on, don't hesitate to check which unit you didn't pass and update these models.
 
 
310
  """
311
 
312
  else:
@@ -316,7 +320,7 @@ def verify_certification(df, hf_username, first_name, last_name):
316
 
317
  # Add a message
318
  message = """
319
- You **didn't pass the minimum of 80%** of the hands-on to get a certificate of completion. **But don't be discouraged**.
320
  Check below which units you need to do again to get your certificate πŸ’ͺ
321
  """
322
  print("return certificate")
@@ -392,12 +396,12 @@ with gr.Blocks() as demo:
392
  last_name = gr.Textbox(placeholder="Doe", label="Your Last Name")
393
  #email = gr.Textbox(placeholder="[email protected]", label="Your Email (to receive your certificate)")
394
  check_progress_button = gr.Button(value="Check if I pass")
395
- with gr.Row(visible=False) as output_row:
396
- output_text = gr.components.Textbox()
397
- output_pdf = gr.File()
398
- output_img = gr.components.Image(type="pil")
399
- output_dataframe = gr.components.Dataframe(headers=["Pass?", "Unit", "Environment", "Baseline", "Your best result", "Your best model id"], datatype=["markdown", "markdown", "markdown", "number", "number", "markdown", "bool"]) #value= certification(hf_username, first_name, last_name),
400
- check_progress_button.click(fn=certification, inputs=[hf_username, first_name, last_name], outputs=[output_text, output_pdf, output_img, output_dataframe, output_row])#[output1, output2])
401
 
402
 
403
  demo.launch(debug=True)
 
259
 
260
 
261
 
262
+ return message, pdf, certificate, df #, output_row.update(visible=True)
263
 
264
  """
265
  Verify that the user pass.
 
291
 
292
  # Add a message
293
  message = """
294
+ Congratulations, you successfully completed the Hugging Face Deep Reinforcement Learning Course πŸŽ‰! \n
295
+ Since you pass 100% of the hands-on you get a Certificate of Excellence πŸŽ“. \n
296
+ You can download your certificate below ⬇️ \n
297
+ Don't hesitate to share your certificate image below on Twitter and Linkedin (you can tag me @ThomasSimonini and @huggingface) πŸ€—
298
  """
299
 
300
  elif pass_percentage < 100 and pass_percentage >= 80:
 
306
 
307
  # Add a message
308
  message = """
309
+ Congratulations, you successfully completed the Hugging Face Deep Reinforcement Learning Course πŸŽ‰! \n
310
+ Since you pass 80% of the hands-on you get a Certificate of Completion πŸŽ“. \n
311
+ You can download your certificate below ⬇️ \n
312
+ Don't hesitate to share your certificate image below on Twitter and Linkedin (you can tag me @ThomasSimonini and @huggingface) πŸ€— \n
313
+ You can try to get a Certificate of Excellence if you pass 100% of the hands-on, don't hesitate to check which unit you didn't pass and update these models.
314
  """
315
 
316
  else:
 
320
 
321
  # Add a message
322
  message = """
323
+ You didn't pass the minimum of 80% of the hands-on to get a certificate of completion. But don't be discouraged! \n
324
  Check below which units you need to do again to get your certificate πŸ’ͺ
325
  """
326
  print("return certificate")
 
396
  last_name = gr.Textbox(placeholder="Doe", label="Your Last Name")
397
  #email = gr.Textbox(placeholder="[email protected]", label="Your Email (to receive your certificate)")
398
  check_progress_button = gr.Button(value="Check if I pass")
399
+ #with gr.Row(visible=False) as output_row:
400
+ output_text = gr.components.Textbox()
401
+ output_pdf = gr.File()
402
+ output_img = gr.components.Image(type="pil")
403
+ output_dataframe = gr.components.Dataframe(headers=["Pass?", "Unit", "Environment", "Baseline", "Your best result", "Your best model id"], datatype=["markdown", "markdown", "markdown", "number", "number", "markdown", "bool"]) #value= certification(hf_username, first_name, last_name),
404
+ check_progress_button.click(fn=certification, inputs=[hf_username, first_name, last_name], outputs=[output_text, output_pdf, output_img, output_dataframe])#, output_row])#[output1, output2])
405
 
406
 
407
  demo.launch(debug=True)