Spaces:
Sleeping
Sleeping
File size: 3,052 Bytes
d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 d068091 5fdef64 |
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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
import gradio as gr
import google.generativeai as genai
import os
from dotenv import load_dotenv
# Load environment variable
load_dotenv()
API_KEY = os.getenv("GEMINI_API_KEY")
genai.configure(api_key=API_KEY)
model = genai.GenerativeModel("gemini-pro")
# --- AI Functions ---
def generate_resume(name, email, phone, summary, experience, education, skills):
prompt = f"""
Create a professional resume using the following details:
Name: {name}
Email: {email}
Phone: {phone}
Summary:
{summary}
Experience:
{experience}
Education:
{education}
Skills:
{skills}
Format it clearly and professionally.
"""
response = model.generate_content(prompt)
return response.text
def score_resume(resume, job_desc):
prompt = f"""
Evaluate how well the following resume matches the job description below.
Return a match score out of 100 and specific, actionable suggestions to improve the resume.
Resume:
{resume}
Job Description:
{job_desc}
"""
response = model.generate_content(prompt)
return response.text
def refine_section(section_text, instruction):
prompt = f"Refine this section according to the instruction.\nInstruction: {instruction}\nText: {section_text}"
response = model.generate_content(prompt)
return response.text
# --- Gradio UI ---
with gr.Blocks() as demo:
gr.Markdown("## 🤖 AI Resume Builder using Gemini")
with gr.Tab("1️⃣ Generate Resume"):
name = gr.Textbox(label="Name")
email = gr.Textbox(label="Email")
phone = gr.Textbox(label="Phone")
summary = gr.Textbox(label="Professional Summary")
experience = gr.Textbox(label="Experience")
education = gr.Textbox(label="Education")
skills = gr.Textbox(label="Skills")
resume_output = gr.Textbox(label="Generated Resume", lines=15)
generate_btn = gr.Button("Generate Resume")
generate_btn.click(
fn=generate_resume,
inputs=[name, email, phone, summary, experience, education, skills],
outputs=resume_output
)
with gr.Tab("2️⃣ Score Resume Against Job"):
resume_input = gr.Textbox(label="Your Resume", lines=10)
job_desc = gr.Textbox(label="Job Description", lines=5)
score_output = gr.Textbox(label="Match Score & Suggestions", lines=10)
score_btn = gr.Button("Evaluate")
score_btn.click(
fn=score_resume,
inputs=[resume_input, job_desc],
outputs=score_output
)
with gr.Tab("3️⃣ Refine Resume Section"):
section_input = gr.Textbox(label="Resume Section", lines=5)
instruction_input = gr.Textbox(label="Refinement Instruction")
refined_output = gr.Textbox(label="Refined Text", lines=5)
refine_btn = gr.Button("Refine")
refine_btn.click(
fn=refine_section,
inputs=[section_input, instruction_input],
outputs=refined_output
)
demo.launch()
|