File size: 2,249 Bytes
70f4e26 6f3126a 70f4e26 6f3126a 70f4e26 6f3126a 70f4e26 6f3126a 70f4e26 6f3126a 70f4e26 6f3126a 70f4e26 6f3126a 70f4e26 6f3126a 70f4e26 6f3126a 70f4e26 6f3126a 70f4e26 6f3126a 70f4e26 6f3126a | 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 | import gradio as gr
import pandas as pd
import traceback
from model import screen_resumes_backend
def process(job_description, files, model_option, threshold, gmail, password):
try:
if not job_description or len(job_description) < 20:
return "β Job description too short", None, None
# if email provided β use Gmail mode
if gmail and password:
results, report, zip_path = screen_resumes_backend(
job_description,
files=None,
model_name=model_option,
threshold=threshold,
gmail=gmail,
password=password
)
else:
# file upload mode
if not files:
return "β Upload files or provide email", None, None
results, report, zip_path = screen_resumes_backend(
job_description,
files,
model_option,
threshold
)
df = pd.DataFrame(results)
return "β
Process Completed", df, zip_path
except Exception as e:
return f"β Error: {str(e)}\n{traceback.format_exc()}", None, None
# ================= UI =================
with gr.Blocks(title="AI Resume Screener") as demo:
gr.Markdown("# π§ AI Resume Screening System")
job_desc = gr.Textbox(label="Job Description", lines=6)
model = gr.Dropdown(
["Fast (MiniLM)", "Balanced (Recommended)", "High Accuracy"],
value="Balanced (Recommended)"
)
threshold = gr.Slider(0.4, 0.9, value=0.6)
# π₯ NEW: EMAIL SECTION
gr.Markdown("## π§ Email Integration (Optional)")
gmail = gr.Textbox(label="Gmail Address")
password = gr.Textbox(label="App Password (NOT normal password)", type="password")
gr.Markdown("OR Upload Files Below π")
files = gr.File(file_count="multiple", label="Upload CVs (PDF/DOCX)")
btn = gr.Button("Process")
output_text = gr.Markdown()
output_table = gr.DataFrame()
download_zip = gr.File()
btn.click(
process,
inputs=[job_desc, files, model, threshold, gmail, password],
outputs=[output_text, output_table, download_zip]
)
demo.launch() |