cdcvd's picture
Update app.py
03ab049 verified
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 ,evaluate_with_qwen
def extract_text_from_pdf(pdf_file):
document = fitz.open(pdf_file)
text = ""
for page_num in range(len(document)):
page = document.load_page(page_num)
text += page.get_text()
return text
def evaluate_all_models(pdf_file, job_description):
resume_text = extract_text_from_pdf(pdf_file)
gpt_result = evaluate_with_gpt(resume_text, job_description)
gemma_result = evaluate_with_gemma(resume_text, job_description)
bloom_result = evaluate_with_bloom(resume_text, job_description)
jabir_result = evaluate_with_jabir(resume_text, job_description)
llama_result = evaluate_with_llama(resume_text, job_description)
qwen_result=evaluate_with_qwen(resume_text, job_description)
return f"GPT-4o Result:\n{gpt_result}\n\nGemma Result:\n{gemma_result}\n\nBloom Result:\n{bloom_result}\n\nJabir Result:\n{jabir_result}\n\nLlama Result:\n{llama_result}\n\nqwen_result:\n{qwen_result}"
import gradio as gr
from models import evaluate_with_gpt, evaluate_with_gemma, evaluate_with_bloom, evaluate_with_jabir, evaluate_with_llama,evaluate_with_qwen
def evaluate_multiple_resumes(resume_texts, job_description, model):
results = []
for resume_text in resume_texts.split("\n\n"): # Assuming each resume text is separated by two newlines
if model == "GPT-4o":
result = evaluate_with_gpt(resume_text, job_description)
elif model == "Gemma":
result = evaluate_with_gemma(resume_text, job_description)
elif model == "Bloom":
result = evaluate_with_bloom(resume_text, job_description)
elif model == "jabir":
result = evaluate_with_jabir(resume_text, job_description)
elif model == "llama":
result = evaluate_with_llama(resume_text, job_description)
elif model=="qwen":
evaluate_with_qwen(resume_text, job_description)
else:
gpt_result = evaluate_with_gpt(resume_text, job_description)
gemma_result = evaluate_with_gemma(resume_text, job_description)
bloom_result = evaluate_with_bloom(resume_text, job_description)
jabir_result = evaluate_with_jabir(resume_text, job_description)
llama_result = evaluate_with_llama(resume_text, job_description)
qwen_result=evaluate_with_qwen(resume_text, job_description)
result = f"GPT-4o Result:\n{gpt_result}\n\nGemma Result:\n{gemma_result}\n\nBloom Result:\n{bloom_result}\n\nJabir Result:\n{jabir_result}\n\nLlama Result:\n{llama_result}\n\nqwen_result:\n{qwen_result}"
results.append(f"Result for Resume:\n{result}\n\n")
return "\n".join(results)
iface = gr.Interface(
fn=evaluate_multiple_resumes,
inputs=[
gr.Textbox(lines=20, label="Paste Resumes (separate multiple resumes by two newlines)"),
gr.Textbox(lines=10, label="Job Description"),
gr.Radio(choices=["GPT-4o", "Gemma", "Bloom", "jabir", "llama", "qwen","All"], label="Choose Model")
],
outputs="text",
title="Multiple Resume Evaluator"
)
iface.launch()