Vincent Claes commited on
Commit
f54a323
1 Parent(s): f6dc197

inital code

Browse files
Files changed (4) hide show
  1. Pipfile +19 -0
  2. Pipfile.lock +0 -0
  3. app.py +76 -28
  4. requirements.txt +83 -0
Pipfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [[source]]
2
+ url = "https://pypi.org/simple"
3
+ verify_ssl = true
4
+ name = "pypi"
5
+
6
+ [packages]
7
+ gradio = "*"
8
+ requests = "*"
9
+ openai = "*"
10
+ langchain = "*"
11
+ boto3 = "*"
12
+ utils = "*"
13
+ s3fs = "*"
14
+
15
+ [dev-packages]
16
+
17
+ [requires]
18
+ python_version = "3.10"
19
+ python_full_version = "3.10.9"
Pipfile.lock ADDED
The diff for this file is too large to render. See raw diff
 
app.py CHANGED
@@ -2,15 +2,15 @@ import json
2
  import os
3
  import gradio as gr
4
  import requests
5
- import recruiting_assistant
6
 
7
 
8
- def search_resume(input_text):
9
- url = f"https://n970resrb9.execute-api.eu-west-1.amazonaws.com/dev/prediction" # replace with your API endpoint
10
  headers = {
11
  "Content-Type": "application/json",
12
  "x-api-key": os.environ["API_KEY"],
13
- } # adjust headers as needed
14
  response = requests.post(
15
  url, headers=headers, data=json.dumps({"text": input_text})
16
  )
@@ -19,16 +19,64 @@ def search_resume(input_text):
19
  if "prediction" in response_data:
20
  prediction = response_data["prediction"]
21
  if isinstance(prediction, list):
22
- # Insert a newline after each '.'
23
- # Insert a newline after each '.' and add "Candidate <follow up number>:\n" before each item
24
  updated_prediction = [
25
- f"Candidate {i + 1}:\n=============================\n{s}"
26
  for i, s in enumerate(prediction)
27
  ]
28
  updated_prediction = [s.replace(". ", ".\n") for s in updated_prediction]
29
  updated_prediction = [s.replace("•", "\n - ") for s in updated_prediction]
30
  return "\n\n".join(updated_prediction)
31
- return "No 'prediction' key found in the response or the 'body' is not a list."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  demo = gr.Blocks()
34
 
@@ -42,37 +90,34 @@ with demo:
42
  gr.Markdown(
43
  """
44
 
45
- ## 1. Provide a vacancy and get back relevant resumes from an entire database of resumes for various roles.
46
  """
47
  )
48
- text_vacancy = gr.Textbox(
49
- hint="Paste here a Vacancy...",
50
  lines=7,
51
- label="Copy/paste here a vacancy",
52
  )
53
- b1 = gr.Button("Search Resume").style(
54
  margin=False,
55
  rounded=(False, True, True, False),
56
  full_width=False,
57
  )
58
  text_search_result = gr.Textbox(
59
- hint="Top resumes will appear here ...",
60
- label="Top resumes found in the database",
61
  )
62
  b1.click(
63
- search_resume, inputs=text_vacancy, outputs=text_search_result
64
  )
65
  gr.Markdown(
66
  """
67
 
68
- ## 2. Select an appropriate resume for this vacancy, paste it in the textfield and get a relevant introduction email.
69
  """
70
  )
71
- text_resume = gr.Textbox(
72
- hint="Paste here a Resume...",
73
- label="Copy / Paste here your prefered resume from above and click the button to write an intro ",
74
  )
75
- b2 = gr.Button("Write a relevant intro").style(
76
  margin=False,
77
  rounded=(False, True, True, False),
78
  full_width=False,
@@ -80,22 +125,25 @@ with demo:
80
  gr.Markdown(
81
  """
82
 
83
- ## 3. You have a relevant introduction email to send to the customer.
84
  """
85
  )
86
- text_intro = gr.Textbox(label="Intro Email")
87
- evaluation = gr.Textbox(label="Evaluation of the skills")
88
  b2.click(
89
  recruiting_assistant.create_intro,
90
- inputs=[text_vacancy, text_resume],
91
- outputs=[text_intro, evaluation],
92
  )
93
 
94
  gr.Examples(
95
- fn=search_resume,
96
- inputs=text_vacancy,
 
97
  outputs=text_search_result,
98
  cache_examples=False,
99
  )
100
 
 
 
101
  demo.launch()
 
2
  import os
3
  import gradio as gr
4
  import requests
5
+ import recruiting_assistant # Assuming this module provides the required reversed functionality
6
 
7
 
8
+ def zoek_vacature(input_text):
9
+ url = f"https://3jxjznzonb.execute-api.eu-west-1.amazonaws.com/dev/prediction" # vervang met uw API-eindpunt
10
  headers = {
11
  "Content-Type": "application/json",
12
  "x-api-key": os.environ["API_KEY"],
13
+ } # pas headers indien nodig aan
14
  response = requests.post(
15
  url, headers=headers, data=json.dumps({"text": input_text})
16
  )
 
19
  if "prediction" in response_data:
20
  prediction = response_data["prediction"]
21
  if isinstance(prediction, list):
22
+ # Voeg een nieuwe regel toe na elke '.' en voeg "Vacature <volgnummer>:\n" toe voor elk item
 
23
  updated_prediction = [
24
+ f"Vacature {i + 1}:\n=============================\n{s}"
25
  for i, s in enumerate(prediction)
26
  ]
27
  updated_prediction = [s.replace(". ", ".\n") for s in updated_prediction]
28
  updated_prediction = [s.replace("•", "\n - ") for s in updated_prediction]
29
  return "\n\n".join(updated_prediction)
30
+ return "niets teruggevonden ..."
31
+
32
+ examples =[[
33
+ """
34
+ Naam: John Doe
35
+ Adres: Parkstraat 123, 1000 Stadsveld
36
+ Telefoon: +31 6 1234 5678
37
+ E-mail: john.doe@email.com
38
+ Geboortedatum: 15 juli 1985
39
+ Nationaliteit: Nederlandse
40
+
41
+ Profiel:
42
+ Een toegewijde en bekwame koeltechnieker met 8 jaar ervaring in het ontwerpen, installeren, onderhouden en repareren van koelsystemen. Technisch onderlegd en bekend met verschillende koeltechnieken. Een probleemoplosser die snel storingen kan diagnosticeren en efficiënte oplossingen kan implementeren. Goed in teamverband en klantgericht.
43
+
44
+ Werkervaring:
45
+
46
+ Service Technicus bij KoelTech B.V. - januari 2018 tot heden
47
+
48
+ Verantwoordelijk voor het installeren en onderhouden van commerciële en industriële koelsystemen.
49
+ Diagnose stellen en repareren van storingen in koelapparatuur.
50
+ Uitvoeren van preventief onderhoud om de prestaties van koelinstallaties te optimaliseren.
51
+ Klantgerichte aanpak om vragen en problemen van klanten op te lossen.
52
+ Assistent Koeltechnieker bij CoolAir Installaties - maart 2014 tot december 2017
53
+
54
+ Betrokken bij het ontwerp en de installatie van nieuwe koelsystemen in residentiële gebouwen.
55
+ Uitvoeren van druk- en temperatuurmetingen om de juiste werking van de systemen te waarborgen.
56
+ Oplossen van technische problemen en het vervangen van defecte onderdelen.
57
+ Het trainen van klanten in het juiste gebruik en onderhoud van koelapparatuur.
58
+ Opleiding:
59
+
60
+ MBO Koeltechniek - Technische School Stadsveld - 2014
61
+ Certificaat Veilig werken met koelinstallaties - Koelacademie Nederland - 2014
62
+ Vaardigheden:
63
+
64
+ Uitgebreide kennis van verschillende koeltechnieken en -systemen.
65
+ Sterk technisch inzicht en probleemoplossend vermogen.
66
+ Bekend met veiligheidsvoorschriften en -procedures in de koeltechniek.
67
+ Goede communicatieve vaardigheden om effectief te kunnen samenwerken met collega's en klanten.
68
+ Bekwaamheid in het lezen van technische tekeningen en schema's.
69
+ Talen:
70
+
71
+ Nederlands: Moedertaal
72
+ Engels: Goed
73
+ Referenties:
74
+ Beschikbaar op verzoek.
75
+
76
+ Opmerking: Dit CV bevat fictieve gegevens en dient alleen ter illustratie. Gebruik het als een sjabloon en vervang de gegevens door je eigen informatie bij het maken van een CV.
77
+ """
78
+ ]]
79
+
80
 
81
  demo = gr.Blocks()
82
 
 
90
  gr.Markdown(
91
  """
92
 
93
+ ## 1. Voer een CV in en krijg relevante vacatures terug.
94
  """
95
  )
96
+ text_cv = gr.Textbox(
 
97
  lines=7,
98
+ label="Plak hier een CV...",
99
  )
100
+ b1 = gr.Button("Zoek Vacatures").style(
101
  margin=False,
102
  rounded=(False, True, True, False),
103
  full_width=False,
104
  )
105
  text_search_result = gr.Textbox(
106
+ label="Top vacatures gevonden in de database",
 
107
  )
108
  b1.click(
109
+ zoek_vacature, inputs=text_cv, outputs=text_search_result
110
  )
111
  gr.Markdown(
112
  """
113
 
114
+ ## 2. Selecteer een geschikte vacature voor deze CV, plak deze in het tekstveld en krijg een relevante intro.
115
  """
116
  )
117
+ text_vacature = gr.Textbox(
118
+ label="Kopieer / Plak hier uw voorkeursvacature van hierboven en klik op de knop om een sollicitatie te schrijven",
 
119
  )
120
+ b2 = gr.Button("Schrijf een relevante sollicitatie").style(
121
  margin=False,
122
  rounded=(False, True, True, False),
123
  full_width=False,
 
125
  gr.Markdown(
126
  """
127
 
128
+ ## 3. U heeft een relevante intro.
129
  """
130
  )
131
+ text_intro = gr.Textbox(label="Introductie E-mail")
132
+ evaluatie = gr.Textbox(label="Evaluatie van de functie-eisen")
133
  b2.click(
134
  recruiting_assistant.create_intro,
135
+ inputs=[text_vacature, text_cv],
136
+ outputs=[text_intro, evaluatie],
137
  )
138
 
139
  gr.Examples(
140
+ examples=examples,
141
+ fn=zoek_vacature,
142
+ inputs=text_cv,
143
  outputs=text_search_result,
144
  cache_examples=False,
145
  )
146
 
147
+
148
+
149
  demo.launch()
requirements.txt ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -i https://pypi.org/simple
2
+ aiofiles==23.1.0 ; python_version >= '3.7' and python_version < '4.0'
3
+ aiohttp==3.8.5 ; python_version >= '3.6'
4
+ aiosignal==1.3.1 ; python_version >= '3.7'
5
+ altair==5.0.1 ; python_version >= '3.7'
6
+ anyio==3.7.1 ; python_version >= '3.7'
7
+ async-timeout==4.0.2 ; python_version < '3.11'
8
+ attrs==23.1.0 ; python_version >= '3.7'
9
+ boto3==1.28.20
10
+ botocore==1.31.20 ; python_version >= '3.7'
11
+ certifi==2023.7.22 ; python_version >= '3.6'
12
+ charset-normalizer==3.2.0 ; python_full_version >= '3.7.0'
13
+ click==8.1.6 ; python_version >= '3.7'
14
+ contourpy==1.1.0 ; python_version >= '3.8'
15
+ cycler==0.11.0 ; python_version >= '3.6'
16
+ dataclasses-json==0.5.14 ; python_version < '3.13' and python_version >= '3.7'
17
+ exceptiongroup==1.1.2 ; python_version < '3.11'
18
+ fastapi==0.101.0 ; python_version >= '3.7'
19
+ ffmpy==0.3.1
20
+ filelock==3.12.2 ; python_version >= '3.7'
21
+ fonttools==4.42.0 ; python_version >= '3.8'
22
+ frozenlist==1.4.0 ; python_version >= '3.8'
23
+ fsspec==2023.6.0 ; python_version >= '3.8'
24
+ gradio==3.39.0
25
+ gradio-client==0.3.0 ; python_version >= '3.8'
26
+ h11==0.14.0 ; python_version >= '3.7'
27
+ httpcore==0.17.3 ; python_version >= '3.7'
28
+ httpx==0.24.1 ; python_version >= '3.7'
29
+ huggingface-hub==0.16.4 ; python_full_version >= '3.7.0'
30
+ idna==3.4 ; python_version >= '3.5'
31
+ jinja2==3.1.2 ; python_version >= '3.7'
32
+ jmespath==1.0.1 ; python_version >= '3.7'
33
+ jsonschema==4.18.6 ; python_version >= '3.8'
34
+ jsonschema-specifications==2023.7.1 ; python_version >= '3.8'
35
+ kiwisolver==1.4.4 ; python_version >= '3.7'
36
+ langchain==0.0.252
37
+ langsmith==0.0.19 ; python_version < '4.0' and python_full_version >= '3.8.1'
38
+ linkify-it-py==2.0.2
39
+ markdown-it-py[linkify]==2.2.0 ; python_version >= '3.7'
40
+ markupsafe==2.1.3 ; python_version >= '3.7'
41
+ marshmallow==3.20.1 ; python_version >= '3.8'
42
+ matplotlib==3.7.2 ; python_version >= '3.8'
43
+ mdit-py-plugins==0.3.3 ; python_version >= '3.7'
44
+ mdurl==0.1.2 ; python_version >= '3.7'
45
+ multidict==6.0.4 ; python_version >= '3.7'
46
+ mypy-extensions==1.0.0 ; python_version >= '3.5'
47
+ numexpr==2.8.4 ; python_version >= '3.7'
48
+ numpy==1.25.2 ; python_version >= '3.9'
49
+ openai==0.27.8
50
+ openapi-schema-pydantic==1.2.4 ; python_full_version >= '3.6.1'
51
+ orjson==3.9.2 ; python_version >= '3.7'
52
+ packaging==23.1 ; python_version >= '3.7'
53
+ pandas==2.0.3 ; python_version >= '3.8'
54
+ pillow==10.0.0 ; python_version >= '3.8'
55
+ pydantic==1.10.12 ; python_version >= '3.7'
56
+ pydub==0.25.1
57
+ pyparsing==3.0.9 ; python_full_version >= '3.6.8'
58
+ python-dateutil==2.8.2 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
59
+ python-multipart==0.0.6 ; python_version >= '3.7'
60
+ pytz==2023.3
61
+ pyyaml==6.0.1 ; python_version >= '3.6'
62
+ referencing==0.30.2 ; python_version >= '3.8'
63
+ requests==2.31.0 ; python_version >= '3.7'
64
+ rpds-py==0.9.2 ; python_version >= '3.8'
65
+ s3fs==0.4.2
66
+ s3transfer==0.6.1 ; python_version >= '3.7'
67
+ semantic-version==2.10.0 ; python_version >= '2.7'
68
+ six==1.16.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
69
+ sniffio==1.3.0 ; python_version >= '3.7'
70
+ sqlalchemy==2.0.19 ; python_version >= '3.7'
71
+ starlette==0.27.0 ; python_version >= '3.7'
72
+ tenacity==8.2.2 ; python_version >= '3.6'
73
+ toolz==0.12.0 ; python_version >= '3.5'
74
+ tqdm==4.65.0 ; python_version >= '3.7'
75
+ typing-extensions==4.7.1 ; python_version >= '3.7'
76
+ typing-inspect==0.9.0
77
+ tzdata==2023.3 ; python_version >= '2'
78
+ uc-micro-py==1.0.2 ; python_version >= '3.7'
79
+ urllib3==1.26.16 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
80
+ utils==1.0.1
81
+ uvicorn==0.23.2 ; python_version >= '3.8'
82
+ websockets==11.0.3 ; python_version >= '3.7'
83
+ yarl==1.9.2 ; python_version >= '3.7'