TKM03 commited on
Commit
113d04e
·
verified ·
1 Parent(s): 05f07bc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
+ import torch
4
+
5
+ # Load model
6
+ model_name = "shashu2325/resume-job-matcher-lora"
7
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
8
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
9
+
10
+ def match_resume(resume_text, job_text):
11
+ inputs = tokenizer(resume_text, job_text, return_tensors="pt", truncation=True)
12
+ with torch.no_grad():
13
+ outputs = model(**inputs)
14
+ score = torch.nn.functional.softmax(outputs.logits, dim=1)[0][1].item()
15
+ return f"Match Score: {score*100:.2f}%"
16
+
17
+ demo = gr.Interface(
18
+ fn=match_resume,
19
+ inputs=[
20
+ gr.Textbox(label="Resume Text", lines=15),
21
+ gr.Textbox(label="Job Description", lines=15),
22
+ ],
23
+ outputs="text",
24
+ title="Resume-Job Matcher",
25
+ description="Paste a resume and a job description to get a match score."
26
+ )
27
+
28
+ demo.launch()