halimbahae commited on
Commit
5302799
·
verified ·
1 Parent(s): 87dffda

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +97 -0
app.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from huggingface_hub import InferenceClient
3
+
4
+ # Initialize the Inference Client
5
+ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
6
+
7
+ def ats_friendly_checker(resume):
8
+ # Implement the ATS-friendly checker logic here
9
+ # For demonstration, we'll return a mock score and feedback
10
+ score = 75 # Mock score
11
+ feedback = "Your resume needs more keywords related to the job."
12
+ return score, feedback
13
+
14
+ def resume_match_checker(resume, job_description):
15
+ # Implement the resume match logic here
16
+ # For demonstration, we'll return a mock match score
17
+ match_score = 80 # Mock match score
18
+ return match_score
19
+
20
+ def resume_quality_score(resume):
21
+ # Implement the resume quality scoring logic here
22
+ # For demonstration, we'll return a mock quality score
23
+ quality_score = 85 # Mock quality score
24
+ return quality_score
25
+
26
+ def text_to_overleaf(resume_text):
27
+ # Implement the conversion to Overleaf code here
28
+ # For demonstration, we'll return a mock Overleaf code
29
+ overleaf_code = "Mock Overleaf Code"
30
+ return overleaf_code
31
+
32
+ def respond(
33
+ message,
34
+ history: list[tuple[str, str]],
35
+ system_message,
36
+ max_tokens,
37
+ temperature,
38
+ top_p,
39
+ ):
40
+ messages = [{"role": "system", "content": system_message}]
41
+
42
+ for val in history:
43
+ if val[0]:
44
+ messages.append({"role": "user", "content": val[0]})
45
+ if val[1]:
46
+ messages.append({"role": "assistant", "content": val[1]})
47
+
48
+ messages.append({"role": "user", "content": message})
49
+
50
+ response = ""
51
+
52
+ for message in client.chat_completion(
53
+ messages,
54
+ max_tokens=max_tokens,
55
+ stream=True,
56
+ temperature=temperature,
57
+ top_p=top_p,
58
+ ):
59
+ token = message.choices[0].delta.content
60
+
61
+ response += token
62
+ yield response
63
+
64
+ # Define the Gradio interface
65
+ with gr.Blocks() as demo:
66
+ gr.Markdown("# Resume Enhancement Tool\nEnhance your resume with the following features.")
67
+
68
+ with gr.Tab("ATS-Friendly Checker"):
69
+ with gr.Row():
70
+ resume = gr.File(label="Upload your Resume (PDF)")
71
+ score = gr.Number(label="ATS Score", interactive=False)
72
+ feedback = gr.Textbox(label="Feedback", interactive=False)
73
+ resume.upload(ats_friendly_checker, resume, [score, feedback])
74
+
75
+ with gr.Tab("Resume Match Checker"):
76
+ with gr.Row():
77
+ resume = gr.File(label="Upload your Resume (PDF)")
78
+ job_description = gr.Textbox(label="Job Description")
79
+ match_score = gr.Number(label="Match Score", interactive=False)
80
+ resume.upload(resume_match_checker, [resume, job_description], match_score)
81
+
82
+ with gr.Tab("Resume Quality Score"):
83
+ with gr.Row():
84
+ resume = gr.File(label="Upload your Resume (PDF)")
85
+ quality_score = gr.Number(label="Quality Score", interactive=False)
86
+ resume.upload(resume_quality_score, resume, quality_score)
87
+
88
+ with gr.Tab("Text to Overleaf Code"):
89
+ with gr.Row():
90
+ resume_text = gr.Textbox(label="Resume Text")
91
+ overleaf_code = gr.Textbox(label="Overleaf Code", interactive=False)
92
+ resume_text.submit(text_to_overleaf, resume_text, overleaf_code)
93
+
94
+ gr.Markdown("---\nBuilt with love by [Bahae Eddine HALIM](https://www.linkedin.com/in/halimbahae/)")
95
+
96
+ if __name__ == "__main__":
97
+ demo.launch()