Commit
β’
1c0393e
1
Parent(s):
7539ced
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
-
from huggingface_hub import HfApi, hf_hub_download
|
3 |
from huggingface_hub.repocard import metadata_load
|
4 |
-
from huggingface_hub import HfApi, Repository
|
5 |
|
6 |
from PIL import Image, ImageDraw, ImageFont
|
7 |
|
@@ -122,6 +121,7 @@ def check_if_passed(model):
|
|
122 |
if model["best_result"] >= model["min_result"]:
|
123 |
model["passed_"] = True
|
124 |
|
|
|
125 |
def certification(hf_username, first_name, last_name):
|
126 |
results_certification = [
|
127 |
{
|
@@ -289,7 +289,7 @@ def verify_certification(df, hf_username, first_name, last_name):
|
|
289 |
# Add a message
|
290 |
message = """
|
291 |
Congratulations, you successfully completed the Hugging Face Deep Reinforcement Learning Course π \n
|
292 |
-
Since you pass 100% of the hands-on you get a Certificate of Excellence
|
293 |
"""
|
294 |
|
295 |
elif pass_percentage < 100 and pass_percentage >= 80:
|
@@ -302,7 +302,7 @@ def verify_certification(df, hf_username, first_name, last_name):
|
|
302 |
# Add a message
|
303 |
message = """
|
304 |
Congratulations, you successfully completed the Hugging Face Deep Reinforcement Learning Course π \n
|
305 |
-
Since you pass 80% of the hands-on you get a Certificate of Completion
|
306 |
if you pass 100% of the hands-on, don't hesitate to check which unit you didn't pass and update these models.
|
307 |
"""
|
308 |
|
@@ -313,7 +313,7 @@ def verify_certification(df, hf_username, first_name, last_name):
|
|
313 |
|
314 |
# Add a message
|
315 |
message = """
|
316 |
-
You didn't pass the minimum of 80
|
317 |
Check below which units you need to do again to get your certificate πͺ
|
318 |
"""
|
319 |
print("return certificate")
|
@@ -343,12 +343,15 @@ def generate_certificate(certificate_model, first_name, last_name):
|
|
343 |
# Date of certification
|
344 |
d.text((1480, 1170), str(date.today()), fill="black", anchor="mm", font=date_font)
|
345 |
|
346 |
-
pdf = im.save("
|
347 |
|
348 |
return im, pdf
|
349 |
|
350 |
|
351 |
def add_certified_user(hf_username, first_name, last_name, pass_percentage):
|
|
|
|
|
|
|
352 |
print("ADD CERTIFIED USER")
|
353 |
repo.git_pull()
|
354 |
history = pd.read_csv(os.path.join(CERTIFIED_USERS_DIR, CERTIFIED_USERS_FILENAME))
|
|
|
1 |
import gradio as gr
|
2 |
+
from huggingface_hub import HfApi, hf_hub_download, Repository
|
3 |
from huggingface_hub.repocard import metadata_load
|
|
|
4 |
|
5 |
from PIL import Image, ImageDraw, ImageFont
|
6 |
|
|
|
121 |
if model["best_result"] >= model["min_result"]:
|
122 |
model["passed_"] = True
|
123 |
|
124 |
+
|
125 |
def certification(hf_username, first_name, last_name):
|
126 |
results_certification = [
|
127 |
{
|
|
|
289 |
# Add a message
|
290 |
message = """
|
291 |
Congratulations, you successfully completed the Hugging Face Deep Reinforcement Learning Course π \n
|
292 |
+
**Since you pass 100% of the hands-on you get a Certificate of Excellence π.**
|
293 |
"""
|
294 |
|
295 |
elif pass_percentage < 100 and pass_percentage >= 80:
|
|
|
302 |
# Add a message
|
303 |
message = """
|
304 |
Congratulations, you successfully completed the Hugging Face Deep Reinforcement Learning Course π \n
|
305 |
+
**Since you pass 80% of the hands-on you get a Certificate of Completion π**. You can try to get a Certificate of Excellence
|
306 |
if you pass 100% of the hands-on, don't hesitate to check which unit you didn't pass and update these models.
|
307 |
"""
|
308 |
|
|
|
313 |
|
314 |
# Add a message
|
315 |
message = """
|
316 |
+
You **didn't pass the minimum of 80%** of the hands-on to get a certificate of completion. **But don't be discouraged**.
|
317 |
Check below which units you need to do again to get your certificate πͺ
|
318 |
"""
|
319 |
print("return certificate")
|
|
|
343 |
# Date of certification
|
344 |
d.text((1480, 1170), str(date.today()), fill="black", anchor="mm", font=date_font)
|
345 |
|
346 |
+
pdf = im.save("certificate"+".pdf")
|
347 |
|
348 |
return im, pdf
|
349 |
|
350 |
|
351 |
def add_certified_user(hf_username, first_name, last_name, pass_percentage):
|
352 |
+
"""
|
353 |
+
Add the certified user to the database
|
354 |
+
"""
|
355 |
print("ADD CERTIFIED USER")
|
356 |
repo.git_pull()
|
357 |
history = pd.read_csv(os.path.join(CERTIFIED_USERS_DIR, CERTIFIED_USERS_FILENAME))
|