Vincent Claes commited on
Commit
bc49c7c
1 Parent(s): ccd2eec

working version

Browse files
Files changed (6) hide show
  1. Makefile +2 -0
  2. Pipfile +15 -0
  3. Pipfile.lock +0 -0
  4. app.py +112 -0
  5. intro.py +124 -0
  6. requirements.txt +69 -0
Makefile ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ deps:
2
+ pipenv requirements > requirements.txt
Pipfile ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [[source]]
2
+ url = "https://pypi.org/simple"
3
+ verify_ssl = true
4
+ name = "pypi"
5
+
6
+ [packages]
7
+ gradio = "==3.26.0"
8
+ requests = "*"
9
+ openai = "*"
10
+ uvicorn = "==0.23.0"
11
+
12
+ [dev-packages]
13
+
14
+ [requires]
15
+ python_version = "3.8"
Pipfile.lock ADDED
The diff for this file is too large to render. See raw diff
 
app.py ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ import requests
4
+ import intro
5
+ def search_resume(input_text):
6
+ from urllib.parse import quote
7
+ encoded_sentence = quote(input_text)
8
+
9
+ url = f"https://n970resrb9.execute-api.eu-west-1.amazonaws.com/dev/prediction/{encoded_sentence}" # replace with your API endpoint
10
+ headers = {'Content-Type': 'application/json', "x-api-key": os.environ["API_KEY"]} # adjust headers as needed
11
+ # data = {"id": input_text} # data to be sent to the API
12
+ response = requests.get(url, headers=headers)
13
+ response_data = response.json()
14
+
15
+ if 'prediction' in response_data:
16
+ prediction = response_data["prediction"]
17
+ if isinstance(prediction, list):
18
+ # Insert a newline after each '.'
19
+ # Insert a newline after each '.' and add "Candidate <follow up number>:\n" before each item
20
+ updated_prediction = [f"Candidate {i+1}:\n=============================\n{s}" for i, s in enumerate(prediction)]
21
+ updated_prediction = [s.replace('. ', '.\n') for s in updated_prediction]
22
+ updated_prediction = [s.replace('•', '\n - ') for s in updated_prediction]
23
+ return "\n\n".join(updated_prediction)
24
+ return "No 'prediction' key found in the response or the 'body' is not a list."
25
+
26
+ examples = [["""
27
+
28
+ DATA SCIENTIST - GENTIS
29
+ ========================
30
+ I am in contact with a top company in Ghent where they are looking for an additional Data Scientist. Beware... Once you start there, you won't be leaving anytime soon. The company likes to keep their employees happy, so few leave.
31
+
32
+ The profile
33
+
34
+ Min of 3 years experience as a Data Scientist
35
+ Experience in Python and SQL
36
+ Communicative very strong
37
+ Experience in coaching and supporting junior collegues
38
+ Experience in Google Cloud is a plus
39
+ Experience in Machine Learning is a plus
40
+ They offer
41
+ An opportunity to be part of not only a fast-growing, innovative company, but one where you as a person can grow professionally as fast as the company
42
+ A close-knit and diverse team who are all ready to help, listen and give advice to each other
43
+ Training opportunities (because they don't stand still, so neither do you)
44
+ Trendy and young company where everyone can be their own
45
+ A very nice salary package and much more
46
+ Lots of remote work and flexibility, so bye bye traffic JAMS!
47
+ A renovated office with everything you could dream of full with surprises and extras
48
+
49
+ If you are interested or want more info, don't hesitate to contact me.
50
+ """],
51
+ [
52
+ """
53
+ Payroll, Benefits & Office Manager
54
+ ================================
55
+
56
+ Your mission:
57
+ As Payroll, Benefits & Office Manager, you will play a crucial role in ensuring an outstanding service to our employees throughout their employee journey.
58
+ You will be managing a team of 5, whilst improving systems and processes and providing support to the overall People and Organisation team.
59
+
60
+ Your responsibilities:
61
+ Manage the People Services team to deliver a "first time right " approach to service delivery, coaching and development of key skills and knowledge ensuring adequate cover across all work areas.
62
+ Responsibility for ensuring that all HR administrative tasks across the full employee life cycle including pre- and post-employment administration, contract issue, contract amendments.
63
+
64
+ Your profile:
65
+ You have a proven track record in People Management.
66
+ Your field of expertise lies in payroll and comp&ben, and experience in Facility Management or Property Management is a strong plus.
67
+
68
+ What we offer you :
69
+ A company on a human scale in which you quickly see the impact of your actions
70
+ An attractive salary package with company car, accompanied by various extra-legal benefits (meal vouchers, group insurance, hospitalization insurance, etc.)
71
+ 39 days off per year
72
+ """
73
+ ]
74
+
75
+ ]
76
+ #
77
+ # iface = gr.Interface(fn=search_resume,
78
+ # inputs=gr.inputs.Textbox(lines=7, placeholder="Enter Text Here..."),
79
+ # outputs="text",
80
+ # examples=examples
81
+ # )
82
+ # iface.launch()
83
+ #
84
+ demo = gr.Blocks()
85
+
86
+
87
+ with demo:
88
+
89
+ text_vacancy = gr.Textbox("Paste here a Vacancy...", lines=7, label="Vacancy")
90
+ b1 = gr.Button("Search Resume")
91
+ text_search_result = gr.Textbox("Top resumes will appear here ...", label="Top resumes found in the database")
92
+ b1.click(search_resume, inputs=text_vacancy, outputs=text_search_result)
93
+
94
+ text_resume = gr.Textbox("Paste here a Resume...", label="Copy / Paste here your prefered resume and click the button to write an intro ")
95
+ b2 = gr.Button("Write a relevant intro")
96
+ text_intro = gr.Textbox()
97
+ b2.click(intro.create,
98
+ inputs=[
99
+ text_vacancy,
100
+ text_resume
101
+ ],
102
+ outputs=text_intro)
103
+
104
+ examples = gr.Examples(
105
+ examples=examples,
106
+ fn=search_resume,
107
+ inputs=text_vacancy,
108
+ outputs=text_search_result,
109
+ cache_examples=False,
110
+ )
111
+
112
+ demo.launch()
intro.py ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import openai
4
+
5
+
6
+ # Define the API key for the OpenAI model
7
+ openai.api_key = os.environ["OPENAI"]
8
+
9
+ # "text-davinci-003": "text-davinci-003 can do any language task with better quality, longer output, and consistent instruction-following than the curie, babbage, or ada models. Also supports inserting completions within text.",
10
+ # "text-curie-001": "text-curie-001 is very capable, faster and lower cost than Davinci.",
11
+ # "text-babbage-001": "text-babbage-001 is capable of straightforward tasks, very fast, and lower cost.",
12
+ # "text-ada-001": "text-ada-001 is capable of very simple tasks, usually the fastest model in the GPT-3 series, and lowest cost.",
13
+ # "gpt-4": "More capable than any GPT-3.5 model, able to do more complex tasks, and optimized for chat. Will be updated with our latest model iteration.",
14
+ # "gpt-3.5-turbo": "Most capable GPT-3.5 model and optimized for chat at 1/10th the cost of text-davinci-003. Will be updated with our latest model iteration",
15
+ MODEL = "gpt-3.5-turbo"
16
+ LANGUAGE = "en" # nl / en
17
+
18
+
19
+ def call_openai(model, prompt):
20
+ response = openai.ChatCompletion.create(
21
+ model=model,
22
+ messages=[
23
+ # {
24
+ # "role": "system",
25
+ # "content": "You are a helpful assistant."
26
+ # },
27
+ {"role": "user", "content": prompt},
28
+ # {
29
+ # "role": "assistant",
30
+ # "content": "Alright, let me summarize that for you."
31
+ # }
32
+ ],
33
+ )
34
+
35
+ result = response["choices"][0]["message"]["content"]
36
+ print("Got a language_response!")
37
+ return result
38
+
39
+ vacancy = """
40
+
41
+
42
+ DATA SCIENTIST - GENTIS
43
+ ========================
44
+
45
+ Profile:
46
+
47
+ Min of 3 years experience as a Data Scientist
48
+ Experience in Python and SQL
49
+ Communicative very strong
50
+ Experience in coaching and supporting junior collegues
51
+ Experience in Google Cloud is a plus
52
+ Experience in Machine Learning is a plus
53
+
54
+ They offer:
55
+
56
+ An opportunity to be part of not only a fast-growing, innovative company, but one where you as a person can grow professionally as fast as the company
57
+ A close-knit and diverse team who are all ready to help, listen and give advice to each other
58
+ Training opportunities (because they don't stand still, so neither do you)
59
+ Trendy and young company where everyone can be their own
60
+ A very nice salary package and much more
61
+ Lots of remote work and flexibility, so bye bye traffic JAMS!
62
+ A renovated office with everything you could dream of full with surprises and extras
63
+
64
+ """
65
+
66
+ resume = """
67
+ John Doe
68
+ =============================
69
+
70
+ Skills
71
+ - Python
72
+ - Tableau
73
+ - Data Visualization
74
+ - R Studio
75
+ - Machine Learning
76
+ - Statistics IABAC Certified Data Scientist with versatile experience over 1+ years in managing business, data science consulting and leading innovation projects, bringing business ideas to working real world solutions.
77
+ Being a strong advocator of augmented era, where human capabilities are enhanced by machines, Fahed is passionate about bringing business concepts in area of machine learning, AI, robotics etc., to real life solutions.Education Details January 2017 B.
78
+ Tech Computer Science & Engineering Mohali, Punjab Indo Global College of Engineering Data Science Consultant Data Science Consultant - Datamites Skill Details MACHINE LEARNING- Exprience - 13 months PYTHON- Exprience - 24 months SOLUTIONS- Exprience - 24 months DATA SCIENCE- Exprience - 24 months DATA VISUALIZATION- Exprience - 24 months Tableau- Exprience - 24 monthsCompany Details company - Datamites description -
79
+ - Analyzed and processed complex data sets using advanced querying, visualization and analytics tools.
80
+
81
+ - Responsible for loading, extracting and validation of client data.
82
+
83
+ - Worked on manipulating, cleaning & processing data using python.
84
+
85
+ - Used Tableau for data visualization.
86
+ company - Heretic Solutions Pvt Ltd description -
87
+ - Worked closely with business to identify issues and used data to propose solutions for effective decision making.
88
+
89
+ - Manipulating, cleansing & processing data using Python, Excel and R.
90
+
91
+ - Analyzed raw data, drawing conclusions & developing recommendations.
92
+
93
+ - Used machine learning tools and statistical techniques to produce solutions to problems.
94
+
95
+ """
96
+
97
+
98
+ def create(vacancy=vacancy, resume=resume):
99
+ cover_letter = f"""
100
+ I have a vacancy below the delimiter <VACANCY:> and I have a candidate its resume below the delimiter <RESUME:>.
101
+
102
+ <VACANCY:>
103
+
104
+ {vacancy}
105
+
106
+ <RESUME:>
107
+
108
+ Can you fill in the introduction email below the delimiter <INTRO:> and only return as answer this introduction email?
109
+
110
+ {resume}
111
+
112
+ <INTRO:>
113
+
114
+ Role: < the role of the vacancy >
115
+ Candidate: < name of the candidate >
116
+ Education: < name the education of the candidate >
117
+ Responsibilities: < did the candidate worked as an individual contributor or did het take on leadership postitions? >
118
+ Experience: < name 2 most relevant experiences from the candidate for this vacancy in a short compact sentence. Add these as a bullet list >
119
+ Skills: < name the most relevant skills from the resume for this vacancy. No other skill should be mentioned. Add these as a bullet list >
120
+
121
+ """
122
+ response = call_openai(model=MODEL, prompt=cover_letter)
123
+ print(response)
124
+ return response
requirements.txt ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -i https://pypi.org/simple
2
+ aiofiles==23.1.0 ; python_version >= '3.7' and python_version < '4.0'
3
+ aiohttp==3.8.4 ; python_version >= '3.6'
4
+ aiosignal==1.3.1 ; python_version >= '3.7'
5
+ altair==5.0.1 ; python_version >= '3.7'
6
+ annotated-types==0.5.0 ; python_version >= '3.7'
7
+ anyio==3.7.1 ; python_version >= '3.7'
8
+ async-timeout==4.0.2 ; python_version >= '3.6'
9
+ attrs==23.1.0 ; python_version >= '3.7'
10
+ certifi==2023.5.7 ; python_version >= '3.6'
11
+ charset-normalizer==3.2.0 ; python_full_version >= '3.7.0'
12
+ click==8.1.6 ; python_version >= '3.7'
13
+ contourpy==1.1.0 ; python_version >= '3.8'
14
+ cycler==0.11.0 ; python_version >= '3.6'
15
+ fastapi==0.100.0 ; python_version >= '3.7'
16
+ ffmpy==0.3.1
17
+ filelock==3.12.2 ; python_version >= '3.7'
18
+ fonttools==4.41.0 ; python_version >= '3.8'
19
+ frozenlist==1.4.0 ; python_version >= '3.8'
20
+ fsspec==2023.6.0 ; python_version >= '3.8'
21
+ gradio==3.26.0
22
+ gradio-client==0.1.2 ; python_version >= '3.7'
23
+ h11==0.14.0 ; python_version >= '3.7'
24
+ httpcore==0.17.3 ; python_version >= '3.7'
25
+ httpx==0.24.1 ; python_version >= '3.7'
26
+ huggingface-hub==0.16.4 ; python_full_version >= '3.7.0'
27
+ idna==3.4 ; python_version >= '3.5'
28
+ jinja2==3.1.2 ; python_version >= '3.7'
29
+ jsonschema==4.18.4 ; python_version >= '3.8'
30
+ jsonschema-specifications==2023.7.1 ; python_version >= '3.8'
31
+ kiwisolver==1.4.4 ; python_version >= '3.7'
32
+ linkify-it-py==2.0.2
33
+ markdown-it-py[linkify]==2.2.0 ; python_version >= '3.7'
34
+ markupsafe==2.1.3 ; python_version >= '3.7'
35
+ matplotlib==3.7.2 ; python_version >= '3.8'
36
+ mdit-py-plugins==0.3.3 ; python_version >= '3.7'
37
+ mdurl==0.1.2 ; python_version >= '3.7'
38
+ multidict==6.0.4 ; python_version >= '3.7'
39
+ numpy==1.25.1 ; python_version >= '3.9'
40
+ openai==0.27.8
41
+ orjson==3.9.2 ; python_version >= '3.7'
42
+ packaging==23.1 ; python_version >= '3.7'
43
+ pandas==2.0.3 ; python_version >= '3.8'
44
+ pillow==10.0.0 ; python_version >= '3.8'
45
+ pydantic==2.0.3 ; python_version >= '3.7'
46
+ pydantic-core==2.3.0 ; python_version >= '3.7'
47
+ pydub==0.25.1
48
+ pygments==2.15.1 ; python_version >= '3.7'
49
+ pyparsing==3.0.9 ; python_full_version >= '3.6.8'
50
+ python-dateutil==2.8.2 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
51
+ python-multipart==0.0.6 ; python_version >= '3.7'
52
+ pytz==2023.3
53
+ pyyaml==6.0.1 ; python_version >= '3.6'
54
+ referencing==0.30.0 ; python_version >= '3.8'
55
+ requests==2.31.0
56
+ rpds-py==0.9.2 ; python_version >= '3.8'
57
+ semantic-version==2.10.0 ; python_version >= '2.7'
58
+ six==1.16.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
59
+ sniffio==1.3.0 ; python_version >= '3.7'
60
+ starlette==0.27.0 ; python_version >= '3.7'
61
+ toolz==0.12.0 ; python_version >= '3.5'
62
+ tqdm==4.65.0 ; python_version >= '3.7'
63
+ typing-extensions==4.7.1 ; python_version >= '3.7'
64
+ tzdata==2023.3 ; python_version >= '2'
65
+ uc-micro-py==1.0.2 ; python_version >= '3.7'
66
+ urllib3==2.0.3 ; python_version >= '3.7'
67
+ uvicorn==0.23.0 ; python_version >= '3.8'
68
+ websockets==11.0.3 ; python_version >= '3.7'
69
+ yarl==1.9.2 ; python_version >= '3.7'