Job / app.py
ngocng19's picture
Update app.py
b330758 verified
import gradio as gr
import pandas as pd
import datetime
import os
# 1. Danh mục Động từ mạnh
ACTION_VERBS_CATALOG = {
"Creation & Design (Sáng tạo)": "Acted, Adapted, Combined, Composed, Conceptualized, Condensed, Created, Customized, Designed, Developed, Devised, Directed, Displayed, Entertained, Established, Fashioned, Formulated, Founded, Illustrated, Initiated, Instituted, Integrated, Introduced, Invented, Modeled, Modified, Originated, Performed, Photographed, Planned, Revised, Revitalized, Shaped, Solve.",
"Research & Analysis (Nghiên cứu)": "Analyzed, Clarified, Collected, Compared, Conducted, Critiqued, Detected, Determined, Diagnosed, Evaluated, Examined, Experimented, Explored, Extracted, Formulated, Gathered, Identified, Inspected, Interpreted, Interviewed, Invented, Investigated, Located, Measured, Organized, Researched, Reviewed, Searched, Solved, Summarized, Surveyed, Systematized.",
"Management & Leadership (Quản lý)": "Accomplished, Administered, Advanced, Analyzed, Appointed, Approved, Assigned, Attained, Authorized, Chaired, Considered, Consolidated, Contracted, Controlled, Converted, Coordinated, Decided, Delegated, Developed, Directed, Eliminated, Emphasized, Enforced, Enhanced, Established, Executed, Generated, Handled, Headed, Hired, Hosted, Improved, Incorporated, Increased, Initiated, Inspected, Instituted, Led, Managed, Merged, Motivated, Navigated, Organized, Originated, Overhauled, Oversaw, Planned, Presided, Prioritized, Produced, Recommended, Reorganized, Replaced, Restored, Reviewed, Scheduled, Secured, Selected, Streamlined, Strengthened, Supervised, Terminated.",
"Financial & Data (Tài chính)": "Administered, Adjusted, Allocated, Analyzed, Appraised, Assessed, Audited, Balanced, Budgeted, Calculated, Computed, Conserved, Controlled, Corrected, Decreased, Determined, Developed, Estimated, Forecasted, Managed, Marketed, Measured, Netted, Planned, Prepared, Programmed, Projected, Qualified, Reconciled, Reduced, Researched, Retrieved.",
"Support & Helping (Hỗ trợ)": "Adapted, Advocated, Aided, Answered, Arranged, Assessed, Assisted, Clarified, Coached, Collaborated, Contributed, Cooperated, Counseled, Demonstrated, Diagnosed, Educated, Encouraged, Ensured, Expedited, Facilitated, Familiarized, Furthered, Guided, Helped, Insured, Intervened, Motivated, Prevented, Provided, Referred, Rehabilitated, Represented, Resolved, Simplified, Supplied, Supported, Volunteered.",
"Technical Expertise (Kỹ thuật)": "Adapted, Applied, Assembled, Built, Calculated, Computed, Conserved, Constructed, Converted, Debugged, Designed, Determined, Developed, Engineered, Fabricated, Fortified, Installed, Maintained, Operated, Overhauled, Printed, Programmed, Rectified, Regulated, Remodeled, Repaired, Replaced, Restored, Solved, Specialized, Standardized, Studied, Upgraded, Utilized.",
"Teaching & Training (Đào tạo)": "Adapted, Advised, Clarified, Coached, Communicated, Conducted, Coordinated, Critiqued, Developed, Enabled, Encouraged, Evaluated, Explained, Facilitated, Focused, Guided, Individualized, Informed, Installed, Instructed, Motivated, Persuaded, Simulated, Stimulated, Taught, Tested, Trained, Transmitted, Tutored."
}
# 2. Database Câu hỏi phỏng vấn
INTERVIEW_SECTIONS = {
"Working Skill & Role Fit": [
"Experience Overview: Describe your work experience relevant to this role.",
"Role Understanding: Which parts of the JD are you familiar with vs new?",
"Process Explanation: Walk me through your step-by-step process for [Task].",
"Tools & Knowledge: What software/systems (SEO, Accounting, CRM) have you used?",
"Workload Capacity: Have you handled high-volume or peak-season work?"
],
"Problem-Solving": [
"Handling Uncertainty: What do you do when you don't know how to do a task?",
"Urgent/Handover Tasks: Describe taking over work with little instruction.",
"Conflict Management: How did you handle a disagreement with a colleague?",
"Supporting Teammates: What do you do if a colleague is struggling?"
],
"Independent Work & Autonomy": [
"Parallel Tasks & Autonomy: How do you manage work independently with limited supervision?",
"Instructions & Comfort Zone: Are you willing to do tasks outside your comfort zone?",
"Self-Perception: How would you describe yourself as a professional?"
],
"Deadline & Stress Management": [
"Task Organization: How do you prioritize multiple tasks and tight deadlines?",
"Feedback & Emotion: How do you handle harsh/critical feedback from a manager?",
"Overtime & Busy Season: Are you ready for OT, holidays, or busy seasons?",
"Pressure: Have you done high workloads? Frequency of tasks A, B, C?"
],
"Motivation & Career": [
"Motivation: Why did you apply? What motivates you?",
"Why Hire You: Why should we hire you for this role?",
"Career Vision: Where do you see yourself in 3-5 years?",
"Expectation & Salary: What are your expectations and salary range?",
"Leaving Reason: Why did you leave your previous famous/good brand job?"
]
}
# 3. Hàm xử lý logic
def save_application(date, job_role, jd_content, status, qualification, hr_name, training, notes, selected_verb_cat, q_cat, question, answer):
data = {
"Date": date,
"Job Role": job_role,
"JD Content": jd_content,
"Status": status,
"Qualification Match": qualification,
"HR Name": hr_name,
"Training Needed": training,
"Notes": notes,
"Verb Category": selected_verb_cat,
"Verbs Reference": ACTION_VERBS_CATALOG.get(selected_verb_cat, ""),
"Interview Category": q_cat,
"Interview Question": question,
"Interview Answer": answer
}
df = pd.DataFrame([data])
file_name = "Job_Application_Tracker.xlsx"
if os.path.exists(file_name):
try:
old_df = pd.read_excel(file_name)
df = pd.concat([old_df, df], ignore_index=True)
except: pass
df.to_excel(file_name, index=False)
return file_name
def update_questions(category):
return gr.update(choices=INTERVIEW_SECTIONS[category], value=INTERVIEW_SECTIONS[category][0])
def show_verbs(category):
return ACTION_VERBS_CATALOG.get(category, "Vui lòng chọn danh mục")
# 4. Giao diện Gradio
with gr.Blocks(theme=gr.themes.Soft()) as demo:
gr.Markdown("# 📋 Professional Job & Outreach Tracker")
with gr.Row():
# --- CỘT TRÁI: NHẬP LIỆU ---
with gr.Column(scale=1, variant="panel"):
gr.Markdown("### 🔍 Analyze JD")
date_in = gr.Textbox(label="Date", value=str(datetime.date.today()))
job_role = gr.Textbox(label="Job Role", placeholder="Ví dụ: Accountant")
jd_input = gr.Textbox(label="Paste Job Description", lines=10)
verb_cat_dropdown = gr.Dropdown(
choices=list(ACTION_VERBS_CATALOG.keys()),
label="Action Verb Category",
value="Research & Analysis (Nghiên cứu)"
)
verb_display = gr.Textbox(label="Action Verbs Reference", interactive=False, lines=4)
# --- CỘT PHẢI: CHI TIẾT ---
with gr.Column(scale=2):
with gr.Tabs():
with gr.TabItem("📋 Position Analysis"):
qual = gr.Textbox(label="Qualification Match")
train = gr.Textbox(label="Training Needed")
scope_work = gr.TextArea(label="Scope of Work (Tasks)")
hr_name_in = gr.Textbox(label="HR Name")
mail_status = gr.Dropdown(
choices=["Applied", "Follow-up", "Interview", "Offer", "Rejected"],
label="Status", value="Applied"
)
with gr.TabItem("❓ Interview Questionnaire"):
gr.Markdown("### Interview Prep")
q_category = gr.Dropdown(list(INTERVIEW_SECTIONS.keys()), label="Nhóm kỹ năng", value="Working Skill & Role Fit")
q_list = gr.Dropdown(choices=INTERVIEW_SECTIONS["Working Skill & Role Fit"], label="Câu hỏi cụ thể")
q_answer = gr.TextArea(label="Ghi chú câu trả lời", lines=4)
with gr.TabItem("🤝 Connections & Skills"):
conn_notes = gr.TextArea(label="Notes (Networking)", lines=5)
my_skills = gr.CheckboxGroup(
choices=["Ứng dụng AI", "Phân tích dữ liệu", "Xây dựng content", "Tài chính cá nhân"],
label="🌟 My Core Skills"
)
save_btn = gr.Button("💾 SAVE TO EXCEL", variant="primary", size="lg")
excel_output = gr.File(label="Download Tracker File")
# --- SỰ KIỆN ---
verb_cat_dropdown.change(fn=show_verbs, inputs=verb_cat_dropdown, outputs=verb_display)
q_category.change(fn=update_questions, inputs=q_category, outputs=q_list)
save_btn.click(
fn=save_application,
inputs=[
date_in, job_role, jd_input, mail_status, qual, hr_name_in, train, conn_notes,
verb_cat_dropdown, q_category, q_list, q_answer
],
outputs=excel_output
)
demo.load(fn=show_verbs, inputs=verb_cat_dropdown, outputs=verb_display)
demo.launch(share=True)