Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from fpdf import FPDF
|
|
3 |
from PIL import Image
|
4 |
|
5 |
# Function to generate the CV PDF with an uploaded photo
|
6 |
-
def generate_pdf(full_name, phone, email, linkedin, address,
|
7 |
pdf = FPDF()
|
8 |
pdf.add_page()
|
9 |
|
@@ -27,7 +27,6 @@ def generate_pdf(full_name, phone, email, linkedin, address, title, summary, deg
|
|
27 |
pdf.cell(200, 10, txt=f"Email: {email}", ln=True)
|
28 |
pdf.cell(200, 10, txt=f"LinkedIn: {linkedin}", ln=True)
|
29 |
pdf.cell(200, 10, txt=f"Address: {address}", ln=True)
|
30 |
-
pdf.cell(200, 10, txt=f"Professional Title: {title}", ln=True)
|
31 |
|
32 |
# Professional Summary/Objective
|
33 |
pdf.cell(200, 10, txt="", ln=True)
|
@@ -45,7 +44,7 @@ def generate_pdf(full_name, phone, email, linkedin, address, title, summary, deg
|
|
45 |
pdf.cell(200, 10, txt=f"University: {university}", ln=True)
|
46 |
pdf.cell(200, 10, txt=f"Graduation Date: {graduation}", ln=True)
|
47 |
if courses:
|
48 |
-
pdf.multi_cell(200, 10, txt=f"Relevant Courses: {courses}")
|
49 |
|
50 |
# Work Experience
|
51 |
pdf.cell(200, 10, txt="", ln=True)
|
@@ -55,7 +54,7 @@ def generate_pdf(full_name, phone, email, linkedin, address, title, summary, deg
|
|
55 |
pdf.cell(200, 10, txt=f"Job Title: {work_title}", ln=True)
|
56 |
pdf.cell(200, 10, txt=f"Company: {work_company}", ln=True)
|
57 |
pdf.cell(200, 10, txt=f"Dates: {work_dates}", ln=True)
|
58 |
-
pdf.multi_cell(200, 10, txt=f"Responsibilities: {work_responsibility}")
|
59 |
|
60 |
# Skills
|
61 |
pdf.cell(200, 10, txt="", ln=True)
|
@@ -92,13 +91,13 @@ def generate_pdf(full_name, phone, email, linkedin, address, title, summary, deg
|
|
92 |
return pdf_file
|
93 |
|
94 |
# Gradio interface to get input from user and generate CV with photo
|
95 |
-
def create_cv_with_photo(full_name, phone, email, linkedin, address,
|
96 |
# Save the uploaded photo temporarily
|
97 |
if photo:
|
98 |
photo.save("uploaded_photo.jpg")
|
99 |
-
pdf_file = generate_pdf(full_name, phone, email, linkedin, address,
|
100 |
else:
|
101 |
-
pdf_file = generate_pdf(full_name, phone, email, linkedin, address,
|
102 |
|
103 |
return pdf_file
|
104 |
|
@@ -111,16 +110,15 @@ iface = gr.Interface(
|
|
111 |
gr.Textbox(label="Email"),
|
112 |
gr.Textbox(label="LinkedIn Profile"),
|
113 |
gr.Textbox(label="Address"),
|
114 |
-
gr.Textbox(label="Professional
|
115 |
-
gr.Textbox(label="Professional Summary/Objective"),
|
116 |
gr.Textbox(label="Degree"),
|
117 |
gr.Textbox(label="University/Institution"),
|
118 |
gr.Textbox(label="Graduation Date"),
|
119 |
-
gr.Textbox(label="Relevant Courses
|
120 |
gr.Textbox(label="Work Title"),
|
121 |
gr.Textbox(label="Company Name"),
|
122 |
gr.Textbox(label="Dates of Employment"),
|
123 |
-
gr.Textbox(label="Work Responsibilities", lines=4),
|
124 |
gr.Textbox(label="Skills", lines=3),
|
125 |
gr.Textbox(label="Achievements", lines=2),
|
126 |
gr.Textbox(label="Volunteer/Extracurricular Activities", lines=2),
|
@@ -135,4 +133,5 @@ iface = gr.Interface(
|
|
135 |
# Launch the interface
|
136 |
iface.launch()
|
137 |
|
|
|
138 |
|
|
|
3 |
from PIL import Image
|
4 |
|
5 |
# Function to generate the CV PDF with an uploaded photo
|
6 |
+
def generate_pdf(full_name, phone, email, linkedin, address, summary, degree, university, graduation, courses, work_title, work_company, work_dates, work_responsibility, skills, achievements, extracurricular, certifications, photo):
|
7 |
pdf = FPDF()
|
8 |
pdf.add_page()
|
9 |
|
|
|
27 |
pdf.cell(200, 10, txt=f"Email: {email}", ln=True)
|
28 |
pdf.cell(200, 10, txt=f"LinkedIn: {linkedin}", ln=True)
|
29 |
pdf.cell(200, 10, txt=f"Address: {address}", ln=True)
|
|
|
30 |
|
31 |
# Professional Summary/Objective
|
32 |
pdf.cell(200, 10, txt="", ln=True)
|
|
|
44 |
pdf.cell(200, 10, txt=f"University: {university}", ln=True)
|
45 |
pdf.cell(200, 10, txt=f"Graduation Date: {graduation}", ln=True)
|
46 |
if courses:
|
47 |
+
pdf.multi_cell(200, 10, txt=f"Relevant Courses or Specializations: {courses}")
|
48 |
|
49 |
# Work Experience
|
50 |
pdf.cell(200, 10, txt="", ln=True)
|
|
|
54 |
pdf.cell(200, 10, txt=f"Job Title: {work_title}", ln=True)
|
55 |
pdf.cell(200, 10, txt=f"Company: {work_company}", ln=True)
|
56 |
pdf.cell(200, 10, txt=f"Dates: {work_dates}", ln=True)
|
57 |
+
pdf.multi_cell(200, 10, txt=f"Responsibilities and Achievements: {work_responsibility}")
|
58 |
|
59 |
# Skills
|
60 |
pdf.cell(200, 10, txt="", ln=True)
|
|
|
91 |
return pdf_file
|
92 |
|
93 |
# Gradio interface to get input from user and generate CV with photo
|
94 |
+
def create_cv_with_photo(full_name, phone, email, linkedin, address, summary, degree, university, graduation, courses, work_title, work_company, work_dates, work_responsibility, skills, achievements, extracurricular, certifications, photo):
|
95 |
# Save the uploaded photo temporarily
|
96 |
if photo:
|
97 |
photo.save("uploaded_photo.jpg")
|
98 |
+
pdf_file = generate_pdf(full_name, phone, email, linkedin, address, summary, degree, university, graduation, courses, work_title, work_company, work_dates, work_responsibility, skills, achievements, extracurricular, certifications, "uploaded_photo.jpg")
|
99 |
else:
|
100 |
+
pdf_file = generate_pdf(full_name, phone, email, linkedin, address, summary, degree, university, graduation, courses, work_title, work_company, work_dates, work_responsibility, skills, achievements, extracurricular, certifications, None)
|
101 |
|
102 |
return pdf_file
|
103 |
|
|
|
110 |
gr.Textbox(label="Email"),
|
111 |
gr.Textbox(label="LinkedIn Profile"),
|
112 |
gr.Textbox(label="Address"),
|
113 |
+
gr.Textbox(label="Professional Summary/Objective", lines=2),
|
|
|
114 |
gr.Textbox(label="Degree"),
|
115 |
gr.Textbox(label="University/Institution"),
|
116 |
gr.Textbox(label="Graduation Date"),
|
117 |
+
gr.Textbox(label="Relevant Courses or Specializations", lines=2),
|
118 |
gr.Textbox(label="Work Title"),
|
119 |
gr.Textbox(label="Company Name"),
|
120 |
gr.Textbox(label="Dates of Employment"),
|
121 |
+
gr.Textbox(label="Work Responsibilities and Achievements", lines=4),
|
122 |
gr.Textbox(label="Skills", lines=3),
|
123 |
gr.Textbox(label="Achievements", lines=2),
|
124 |
gr.Textbox(label="Volunteer/Extracurricular Activities", lines=2),
|
|
|
133 |
# Launch the interface
|
134 |
iface.launch()
|
135 |
|
136 |
+
|
137 |
|