Spaces:
Sleeping
Sleeping
File size: 2,659 Bytes
1d1f711 a673074 1d1f711 532ace3 1d1f711 532ace3 a673074 532ace3 a673074 532ace3 a673074 532ace3 a673074 532ace3 a673074 532ace3 a673074 532ace3 a673074 1d1f711 532ace3 a673074 1d1f711 a673074 532ace3 1d1f711 a673074 532ace3 1d1f711 a673074 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
from transformers import pipeline
from docx import Document
import gradio as gr
# Load lightweight model for basic text polishing (optional, not used heavily)
generator = pipeline("text-generation", model="tiiuae/falcon-rw-1b", device=-1)
def generate_cv_docx(name, title, location, email, linkedin, github, portfolio,
summary, tech_skills, soft_skills, education,
languages, experience, projects, certifications):
# Create document
doc = Document()
# Header
doc.add_heading(name, level=1)
doc.add_paragraph(f"{title}")
doc.add_paragraph(f"{location} | {email}")
doc.add_paragraph(f"LinkedIn: {linkedin} | GitHub: {github} | Portfolio: {portfolio}")
# Sections
doc.add_heading("Professional Summary", level=2)
doc.add_paragraph(summary)
doc.add_heading("Technical Skills", level=2)
doc.add_paragraph(tech_skills)
doc.add_heading("Soft Skills", level=2)
doc.add_paragraph(soft_skills)
doc.add_heading("Education", level=2)
doc.add_paragraph(education)
doc.add_heading("Languages", level=2)
doc.add_paragraph(languages)
doc.add_heading("Experience", level=2)
doc.add_paragraph(experience)
doc.add_heading("Key Projects", level=2)
doc.add_paragraph(projects)
doc.add_heading("Certifications", level=2)
doc.add_paragraph(certifications)
# Save the file
filepath = "generated_cv.docx"
doc.save(filepath)
return filepath
# Gradio UI
interface = gr.Interface(
fn=generate_cv_docx,
inputs=[
gr.Textbox(label="Full Name"),
gr.Textbox(label="Job Title"),
gr.Textbox(label="Location"),
gr.Textbox(label="Email"),
gr.Textbox(label="LinkedIn URL"),
gr.Textbox(label="GitHub URL"),
gr.Textbox(label="Portfolio URL"),
gr.Textbox(label="Professional Summary", lines=4, placeholder="Write 2–4 lines about your profile..."),
gr.Textbox(label="Technical Skills (Languages, Libraries, Tools)", lines=3),
gr.Textbox(label="Soft Skills", lines=2),
gr.Textbox(label="Education", lines=3),
gr.Textbox(label="Languages Known", lines=2),
gr.Textbox(label="Experience (Job Title, Company, Dates, Bullets)", lines=4),
gr.Textbox(label="Key Projects", lines=4),
gr.Textbox(label="Certifications", lines=3)
],
outputs=gr.File(label="Download Your CV (.docx)"),
title="Free CV Builder (Download as Word)",
description="🧠 Build your CV using a clean form and download it as a Word document — powered by open-source AI, no payment required!"
)
interface.launch()
|