import gradio as gr import fitz # PyMuPDF from models import evaluate_with_gpt, evaluate_with_gemma, evaluate_with_bloom, evaluate_with_jabir, evaluate_with_llama def extract_text_from_pdf(pdf_file): """Extracts and returns the text from a PDF file.""" document = fitz.open(pdf_file) return "".join([page.get_text() for page in document]) def evaluate_resume(resume_text, job_description, model): """Evaluates the resume text using the specified model.""" if model == "GPT-4o": return evaluate_with_gpt(resume_text, job_description) elif model == "Gemma": return evaluate_with_gemma(resume_text, job_description) elif model == "Bloom": return evaluate_with_bloom(resume_text, job_description) elif model == "jabir": return evaluate_with_jabir(resume_text, job_description) elif model == "llama": return evaluate_with_llama(resume_text, job_description) else: # If "All" is selected, evaluate with all models and return combined results. return evaluate_all_models(resume_text, job_description) def evaluate_multiple_resumes(resume_files, job_description, model): """Evaluates multiple resumes and returns the results.""" results = [] for resume_file in resume_files: title = resume_file.name resume_text = extract_text_from_pdf(resume_file) result = evaluate_resume(resume_text, job_description, model) results.append(f"Result for {title}:\n{result}\n\n") return "\n".join(results) iface = gr.Interface( fn=evaluate_multiple_resumes, inputs=[ gr.File(type="filepath", label="Upload Resumes PDF", file_count="multiple"), gr.Textbox(lines=10, label="Job Description"), gr.Radio(choices=["GPT-4o", "Gemma", "Bloom", "jabir", "llama", "All"], label="Choose Model") ], outputs="text", title="Multiple Resume Evaluator" ) iface.launch()