File size: 1,438 Bytes
10eff28
 
 
 
 
 
 
 
 
 
 
 
 
40972da
 
 
 
10eff28
 
 
 
 
 
 
40972da
10eff28
40972da
10eff28
 
 
 
 
 
 
40972da
10eff28
40972da
10eff28
 
 
 
 
 
 
40972da
a444e25
40972da
10eff28
 
 
40972da
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
import gradio as gr
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate
from langchain.chat_models import ChatOpenAI

# Replace this with a CPU-compatible LLM for Hugging Face Spaces
llm = ChatOpenAI(temperature=0.2, model="gpt-3.5-turbo")  # Replace with HuggingFacePipeline if no OpenAI key

prompt_template = PromptTemplate(
    template="""
You are a professional resume screener AI.

Below is a resume and a job description.
Evaluate how well the resume fits the job and provide a plain text output with:
- Match Score (0-100)
- Key Skills matched
- Justification for the score

Resume:
{resume}

Job Description:
{job}

Response:
""",
    input_variables=["resume", "job"]
)

chain = LLMChain(llm=llm, prompt=prompt_template)

def screen_resume(resume, jd):
    try:
        response = chain.run(resume=resume, job=jd)
        return response
    except Exception as e:
        return f"Error: {str(e)}"

iface = gr.Interface(
    fn=screen_resume,
    inputs=[
        gr.Textbox(label="Paste Resume Text", lines=15, placeholder="Paste plain text from resume..."),
        gr.Textbox(label="Paste Job Description", lines=10, placeholder="Paste plain text from JD..."),
    ],
    outputs=gr.Textbox(label="Analysis Result"),
    title="Resume Screener Agent",
    description="Upload a resume and a job description. The AI will match and score them."
)

if __name__ == "__main__":
    iface.launch()