Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
from datasets import load_dataset
|
3 |
from datetime import datetime
|
4 |
import io
|
5 |
-
|
6 |
|
7 |
# Constants
|
8 |
SCORES_DATASET = "agents-course/unit4-students-scores"
|
@@ -33,17 +33,7 @@ def add_certificate_entry(username, name):
|
|
33 |
|
34 |
# Function to generate certificate PDF
|
35 |
def generate_certificate(name, score):
|
36 |
-
|
37 |
-
pdf.add_page()
|
38 |
-
pdf.set_font("Arial", size=24)
|
39 |
-
pdf.cell(200, 20, txt="Certificate of Excellence", ln=True, align="C")
|
40 |
-
pdf.set_font("Arial", size=16)
|
41 |
-
pdf.cell(200, 10, txt=f"Presented to {name}", ln=True, align="C")
|
42 |
-
pdf.cell(200, 10, txt=f"For passing Unit 4 with a score of {score}", ln=True, align="C")
|
43 |
-
pdf.cell(200, 10, txt=f"Date: {datetime.now().strftime('%Y-%m-%d')}", ln=True, align="C")
|
44 |
-
pdf_output = io.BytesIO()
|
45 |
-
pdf.output(pdf_output)
|
46 |
-
pdf_output.seek(0)
|
47 |
return pdf_output
|
48 |
|
49 |
# Main function to handle certificate generation
|
|
|
2 |
from datasets import load_dataset
|
3 |
from datetime import datetime
|
4 |
import io
|
5 |
+
|
6 |
|
7 |
# Constants
|
8 |
SCORES_DATASET = "agents-course/unit4-students-scores"
|
|
|
33 |
|
34 |
# Function to generate certificate PDF
|
35 |
def generate_certificate(name, score):
|
36 |
+
pdf_output = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
return pdf_output
|
38 |
|
39 |
# Main function to handle certificate generation
|