Commit
·
452a3a4
1
Parent(s):
1c0393e
Update app.py
Browse files
app.py
CHANGED
|
@@ -342,11 +342,17 @@ def generate_certificate(certificate_model, first_name, last_name):
|
|
| 342 |
|
| 343 |
# Date of certification
|
| 344 |
d.text((1480, 1170), str(date.today()), fill="black", anchor="mm", font=date_font)
|
| 345 |
-
|
| 346 |
-
|
|
|
|
| 347 |
|
| 348 |
return im, pdf
|
| 349 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 350 |
|
| 351 |
def add_certified_user(hf_username, first_name, last_name, pass_percentage):
|
| 352 |
"""
|
|
|
|
| 342 |
|
| 343 |
# Date of certification
|
| 344 |
d.text((1480, 1170), str(date.today()), fill="black", anchor="mm", font=date_font)
|
| 345 |
+
|
| 346 |
+
im_temp = conv_rgba_to_rgb(im)
|
| 347 |
+
pdf = im_temp.save("certificate"+".pdf")
|
| 348 |
|
| 349 |
return im, pdf
|
| 350 |
|
| 351 |
+
def conv_rgba_to_rgb(_rgba):
|
| 352 |
+
_rgba = Image.open(_rgba)
|
| 353 |
+
_rgb = Image.new('RGB', _rgba.size, (255, 255, 255))
|
| 354 |
+
_rgb.paste(_rgba, mask=_rgba.split()[3])
|
| 355 |
+
return _rgb
|
| 356 |
|
| 357 |
def add_certified_user(hf_username, first_name, last_name, pass_percentage):
|
| 358 |
"""
|