Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,169 +3,133 @@ import random
|
|
3 |
import gradio as gr
|
4 |
import os
|
5 |
|
6 |
-
|
7 |
openai.api_key = os.environ["OpenAPI_Key"]
|
8 |
|
9 |
-
manual = r"""
|
|
|
10 |
|
11 |
-
|
|
|
12 |
|
13 |
-
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
Exercise key:
|
21 |
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
"""
|
32 |
-
AssistantPrompt1 = r"""Trombocytopenie, een tekort aan trombocyten, ontstaat door: '''zowel een verhoogde afbraak als een inadequate productie'''."""
|
33 |
-
UserPrompt2 = r"""Exercise body:
|
34 |
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
"""
|
40 |
-
AssistantPrompt2 = "Het buitenste vlies van het pericard wordt '''het pariëtale pericard''' genoemd."
|
41 |
-
UserPrompt3 = r"""Exercise body:
|
42 |
|
43 |
-
|
44 |
-
Exercise key:
|
45 |
|
46 |
-
|
47 |
-
"""
|
48 |
-
AssistantPrompt3 = "In het geval van acute myocardiale ischemie door gebruik van amfetaminen, ecstasy of cocaïne, treedt hypotensie op door: '''acute myocardiale depressie als gevolg van ischemie en een direct toxisch effect van het middel'''."
|
49 |
-
|
50 |
-
|
51 |
-
# Define the messages for stepTwo
|
52 |
-
UserPrompt21 = "Kennisonderdeel: '''De arteria pulmonalis''' komt rechtstreeks uit het rechterventrikel."
|
53 |
-
AssistantPrompt21 = "Vraag: Welke slagader komt rechtstreeks uit het rechterventrikel?\nJuiste antwoord: De arteria pulmonalis"
|
54 |
-
UserPrompt22 = "Kennisonderdeel: Geografische kenmerken in een klantprofiel geven informatie over '''de woonplaats van een klant''', zoals het land, de regio of de stad."
|
55 |
-
AssistantPrompt22 = "Vraag: Waar geven geografische kenmerken in een klantprofiel informatie over?\nJuiste antwoord: De woonplaats van de klant"
|
56 |
-
|
57 |
-
# Define the messages for stepThree
|
58 |
-
SystemPrompt31 = r"""Je bent een breedgeschoolde professor met veel expertise over de onderwerpen van toetsvragen.
|
59 |
-
|
60 |
-
Genereer uitspraken die niet waar zijn, maar geloofwaardige misvattingen over de informatie in de gepresenteerde vraag.
|
61 |
-
|
62 |
-
Zorg ervoor dat alle misvattingen daadwerkelijk volledig onwaar zijn in alle gevallen en omstandigheden, maar op een subtiele manier. Ze moeten geloofwaardige variaties op het juiste antwoord presenteren.
|
63 |
-
Formuleer je misvattingen overwegend positief, dus vermijd het gebruik van 'geen' en 'niet' en vermijd absoluut/extreem taalgebruik. Zorg dat het taalniveau overeenkomt met het juiste antwoord.
|
64 |
-
Geef geen toelichting bij de misvattingen.
|
65 |
-
|
66 |
-
Let op: zorg dat je misvattingen:
|
67 |
-
- zich strikt richten op de informatie in de vraag, niet op het overkoepelende onderwerp in zijn geheel
|
68 |
-
- geloofwaardig zijn voor iemand met basiskennis over het studieonderwerp"""
|
69 |
-
UserPrompt31 = r"""Studieonderwerp: Het zenuwstelsel
|
70 |
-
Vraag: Wat maakt het zenuwstelsel onder andere mogelijk?
|
71 |
-
Juiste antwoord: Eten, ademen, lopen, en praten"""
|
72 |
-
AssistantPrompt31 = r"""Misvattingen:
|
73 |
-
1. Het zenuwstelsel is direct verantwoordelijk voor het opnemen van zuurstof uit de ingeademde lucht.
|
74 |
-
2. Door het zenuwstelsel kunnen we energie maken uit zonlicht.
|
75 |
-
3. Het zenuwstelsel maakt het mogelijk om vitamine B op te nemen uit zonlicht.
|
76 |
-
4. Het zenuwstelsel maakt het mogelijk om het zuurstofniveau in het bloed te meten.
|
77 |
-
5. Het regelen van de zuurstofbinding aan hemoglobine in de longen wordt mogelijk gemaakt door het zenuwstelsel.
|
78 |
-
6. Het zenuwstelsel maakt het mogelijk om het suikergehalte in het bloed te regelen."""
|
79 |
-
UserPrompt32 = r"""Studieonderwerp: Het zenuwstelsel
|
80 |
-
Vraag: Wat zijn de twee voornaamste zenuwstelsels die we in het lichaam onderscheiden?
|
81 |
-
Juiste antwoord: Het centraal en perifeer zenuwstelsel"""
|
82 |
-
AssistantPrompt32 = r"""Misvattingen:
|
83 |
-
1. In ons lichaam wordt het zenuwstelsel met name onderverdeeld in het autonome en het viscerale zenuwstelsel.
|
84 |
-
2. We verdelen het zenuwstelsel in ons lichaam in de eerste plaats onder in het cerebrale en het spinale zenuwstelsel.
|
85 |
-
3. In het menselijk lichaam worden voornamelijk twee zenuwstelsels onderscheiden: het animale zenuwstelsel en het somatische zenuwstelsel.
|
86 |
-
4. De twee hoofdzenuwstelsels in ons lichaam zijn het motorisch en endocrien systeem.
|
87 |
-
5. Het zenuwstelsel in het lichaam wordt met name onderverdeeld in het interne en externe zenuwstelsel.
|
88 |
-
6. Het zenuwstelsel in het menselijk lichaam wordt meestal onderverdeeld in het oppervlakkige en diepe zenuwstelsel.
|
89 |
-
7. Het zenuwstelsel wordt vaak onderverdeeld in het methische en het hermethische zenuwstelsel.
|
90 |
-
8. De hoofdindeling van het zenuwstelsel is het voorste en het achterste zenuwstelsel."""
|
91 |
-
UserPrompt33 = r"""Studieonderwerp: Klantprofielen en marktsegmentatie
|
92 |
-
Vraag: Bij het opstellen van een klantprofiel, welke soort informatie nemen we daar voornamelijk in mee?
|
93 |
-
Juiste antwoord: Leeftijd, geslacht, en woonplaats"""
|
94 |
-
AssistantPrompt33 = r"""Misvattingen:
|
95 |
-
1. In een klantprofiel worden vooral aankoop- en betalingsgeschiedenis van de klant in detail opgenomen.
|
96 |
-
2. De afkomst van de klant is onmisbaar bij het opstellen van een klantprofiel.
|
97 |
-
3. Wanneer we een klantprofiel samenstellen, leggen we de meeste aandacht op hun onderwijsniveau.
|
98 |
-
4. Een klantprofiel wordt vooral opgesteld op basis van de politieke voorkeuren van de klant.
|
99 |
-
5. Het persoonlijke inkomen van de klant is één van de belangrijkste factoren bij het vormen van een klantprofiel.
|
100 |
-
6. De religieuze overtuigingen van een klant zijn het belangrijkst bij het maken van een klantprofiel.
|
101 |
-
7. Wanneer we een klantprofiel opstellen, geven we vooral voorrang aan de gezondheidsstatus van de klant.
|
102 |
-
8. Bij het opstellen van een klantprofiel is de voornaamste informatie de carrière/beroep van de klant.
|
103 |
-
9. De militaire status is onmisbaar bij het opstellen van een klantprofiel."""
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
# Define the messages for stepFour
|
108 |
-
SystemPrompt41 = r"""Je bent een breed-geschoolde professor. Op basis van een vraag, antwoord en een lijstje met misvattingen genereer je de meest geloofwaardige, doch incorrecte, afleiders voor een meerkeuzevraag.
|
109 |
-
De afleiders moeten eenzelfde lengte, grammaticale structuur en taalniveau hebben als het juiste antwoord.
|
110 |
-
De afleiders moeten geloofwaardig klinken voor iemand die weinig over het onderwerp weet, maar daadwerkelijk volledig onjuist zijn. Ze mogen de vraag op geen enkele manier correct beantwoorden. Zorg dat zij dus het foutieve aspect van de misvatting waarop ze zijn gebaseerd behouden, op een subtiele manier."""
|
111 |
-
UserPrompt41 = r"""Je bent een expert op het gebied van 'Klantprofielen en marktsegmentatie'.
|
112 |
-
Vraag: Welke soort informatie nemen we voornamelijk mee in het opstellen van een klantprofiel?
|
113 |
-
Juiste antwoord: Leeftijd, geslacht, en woonplaats
|
114 |
-
|
115 |
-
Misvattingen:
|
116 |
-
1. In een klantprofiel worden vooral aankoop- en betalingsgeschiedenis van de klant in detail opgenomen.
|
117 |
-
2. De afkomst van de klant is onmisbaar bij het opstellen van een klantprofiel.
|
118 |
-
3. Wanneer we een klantprofiel samenstellen, leggen we de meeste aandacht op hun onderwijsniveau.
|
119 |
-
4. Een klantprofiel wordt vooral opgesteld op basis van de politieke voorkeuren van de klant.
|
120 |
-
5. Het inkomen van de klant is één van de belangrijkste factoren bij het vormen van een klantprofiel.
|
121 |
-
6. De religieuze overtuigingen van een klant zijn het belangrijkst bij het maken van een klantprofiel.
|
122 |
-
7. Wanneer we een klantprofiel opstellen, geven we vooral voorrang aan de gezondheidsstatus van de klant.
|
123 |
-
8. Bij het opstellen van een klantprofiel is de voornaamste informatie de carrière of het beroep van de klant.
|
124 |
-
9. De militaire status is onmisbaar bij het opstellen van een klantprofiel. """
|
125 |
-
AssistantPrompt41 = r"""Vraag:
|
126 |
-
Welke soort informatie nemen we voornamelijk mee in het opstellen van een klantprofiel?
|
127 |
-
|
128 |
-
Juiste antwoord:
|
129 |
-
Leeftijd, geslacht, en woonplaats
|
130 |
-
|
131 |
-
Afleiders:
|
132 |
-
Aankoop- en betaalgeschiedenis
|
133 |
-
Opleidingsniveau en politieke voorkeuren
|
134 |
-
Afkomst, religie, en gezondheidstatus
|
135 |
-
Informatie over carrière en beroep
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
-
"""
|
139 |
-
UserPrompt42 = r"""Je bent een expert op het gebied van het zenuwstelsel.
|
140 |
-
Vraag: Tot welk zenuwstelsel behoort het ruggenmerg?
|
141 |
-
Juiste antwoord: Het centrale zenuwstelsel
|
142 |
-
|
143 |
-
Misvattingen:
|
144 |
-
1. Het ruggenmerg behoort tot het perifere zenuwstelsel.
|
145 |
-
2. Het motorische zenuwstelsel is waar het ruggenmerg bijhoort.
|
146 |
-
3. Het ruggenmerg behoort tot het parasympathisch zenuwstelsel.
|
147 |
-
4. Het ruggenmerg behoort tot het quadratische zenuwstelsel.
|
148 |
-
5. Het ruggenmerg behoort tot het craniale zenuwstelsel.
|
149 |
-
"""
|
150 |
-
AssistantPrompt42 = r"""Vraag:
|
151 |
-
Tot welk zenuwstelsel behoort het ruggenmerg?
|
152 |
-
|
153 |
-
Juiste antwoord:
|
154 |
-
Het centrale zenuwstelsel
|
155 |
-
|
156 |
-
Afleiders:
|
157 |
-
Het perifere zenuwstelsel
|
158 |
-
Het motorische zenuwstelsel
|
159 |
-
Het parasympathisch zenuwstelsel
|
160 |
-
Het quadratische zenuwstelsel"""
|
161 |
-
|
162 |
-
## Define the messages for stepFive
|
163 |
-
#UserPrompt41 = r""""""
|
164 |
-
#AssistantPrompt41 = r""""""
|
165 |
-
#UserPrompt42 = r""""""
|
166 |
-
#AssistantPrompt42 = r""""""
|
167 |
-
#UserPrompt43 = r""""""
|
168 |
-
#AssistantPrompt43 = r""""""
|
169 |
|
170 |
# Function to make API call
|
171 |
def api_call(messages, temperature=0.9, model="gpt-4"):
|
@@ -176,113 +140,36 @@ def api_call(messages, temperature=0.9, model="gpt-4"):
|
|
176 |
).choices[0].message.content
|
177 |
|
178 |
# Function to be called by Gradio interface
|
179 |
-
def
|
180 |
-
# Check if
|
181 |
-
if not
|
182 |
return manual
|
183 |
-
|
184 |
-
if "[CDATA" in input:
|
185 |
# Step 1: User input and first API call ~5secs
|
186 |
stepOne = [
|
187 |
-
{"role": "system", "content":
|
188 |
-
{"role": "user", "content":
|
189 |
-
{"role": "assistant", "content":
|
190 |
-
{"role": "user", "content":
|
191 |
-
|
192 |
-
|
193 |
-
{"role": "assistant", "content": AssistantPrompt3},
|
194 |
-
{"role": "user", "content": input}
|
195 |
]
|
196 |
-
Takeaway = api_call(stepOne, 0.4)
|
197 |
-
strippedTakeaway = Takeaway.replace("'''", '')
|
198 |
-
else:
|
199 |
-
# Skip stepOne and set 'Takeaway' to input
|
200 |
-
strippedTakeaway = input.replace("'''", '')
|
201 |
-
Takeaway = input
|
202 |
-
# Step 2: second API call with first call's output as input ~2secs
|
203 |
-
stepTwo = [
|
204 |
-
{"role": "system", "content": "Je bent onderwijskundige. Genereer 1 vraag waarmee je de kennis van de student toetst over een specifiek stukje informatie (kennisonderdeel)."},
|
205 |
-
{"role": "user", "content": UserPrompt21},
|
206 |
-
{"role": "assistant", "content": AssistantPrompt21},
|
207 |
-
{"role": "user", "content": UserPrompt22},
|
208 |
-
{"role": "assistant", "content": AssistantPrompt22},
|
209 |
-
{"role": "user", "content": "Kennisonderdeel: " + Takeaway}
|
210 |
-
]
|
211 |
-
QandA = api_call(stepTwo, 0.5, "gpt-3.5-turbo")
|
212 |
-
|
213 |
-
# Split the QandA string into question and answer parts
|
214 |
-
lines = QandA.split('\n')
|
215 |
-
# Isolate just the question and answer
|
216 |
-
question = lines[0].split('Vraag: ')[1].strip()
|
217 |
-
answer = lines[1].split('Juiste antwoord: ')[1].strip().rstrip(".")
|
218 |
-
|
219 |
-
# Step 3: next API call with previous call's output as input ~21secs
|
220 |
-
stepThree = [
|
221 |
-
{"role": "system", "content": SystemPrompt31},
|
222 |
-
{"role": "user", "content": UserPrompt31},
|
223 |
-
{"role": "assistant", "content": AssistantPrompt31},
|
224 |
-
{"role": "user", "content": UserPrompt32},
|
225 |
-
{"role": "assistant", "content": AssistantPrompt32},
|
226 |
-
{"role": "user", "content": QandA}
|
227 |
-
]
|
228 |
-
misvattingen = api_call(stepThree)
|
229 |
-
|
230 |
-
#Step 4: ALL elements next API call with previous call's output as input ~23secs
|
231 |
-
stepFour = [
|
232 |
-
{"role": "system", "content": SystemPrompt41},
|
233 |
-
{"role": "user", "content": UserPrompt41},
|
234 |
-
{"role": "assistant", "content": AssistantPrompt41},
|
235 |
-
{"role": "user", "content": UserPrompt42},
|
236 |
-
{"role": "assistant", "content": AssistantPrompt42},
|
237 |
-
{"role": "user", "content": "Je bent medisch expert.\n" + QandA + "\n\n" + misvattingen}
|
238 |
-
]
|
239 |
-
BOTA_mc_elements = api_call(stepFour, 0.7)
|
240 |
-
|
241 |
-
# Split the BOTA_mc_elements string by lines
|
242 |
-
lines = BOTA_mc_elements.split('\n')
|
243 |
-
|
244 |
-
# Find the index where "Afleiders:" appears
|
245 |
-
distractors_index = -1 # Initialize to -1 as a sentinel value
|
246 |
-
for i, line in enumerate(lines):
|
247 |
-
if line.strip() == "Afleiders:":
|
248 |
-
distractors_index = i
|
249 |
-
break
|
250 |
-
|
251 |
-
if distractors_index != -1:
|
252 |
-
# Extract the afleiders into the distractors list and remove any trailing periods
|
253 |
-
distractors = [line.rstrip('.').strip() for line in lines[distractors_index + 1:] if line.strip()]
|
254 |
-
else:
|
255 |
-
# Handle the case where "Afleiders:" is not found
|
256 |
-
distractors = []
|
257 |
-
distractors.append("Geen afleiders gevonden. Herlaad de pagina, klik zonder input op 'Submit' voor instructies, en probeer opnieuw. Gaat het een tweede keer mis? Stuur Ben ten Berge een berichtje met je input.")
|
258 |
-
distractors.append("Geen afleiders gevonden. Herlaad de pagina, klik zonder input op 'Submit' voor instructies, en probeer opnieuw. Gaat het een tweede keer mis? Stuur Ben ten Berge een berichtje met je input.")
|
259 |
-
|
260 |
-
# Generate the two versions of 'Beide bovenstaande' type
|
261 |
-
exercise_1 = f"Vraag:\n{question}\n\n{answer} ✔\n{distractors[0]}\n{distractors[1]}\n{distractors[2]}\n\n\n\n---------------------\nBonus-afleider:\n{distractors[3]}\n\n---------------------\nOf maak er een 'Beide bovenstaande'-vraag van:\nBeide bovenstaande\nGeen van bovenstaande\n\nExtra info:\n{Takeaway}"
|
262 |
-
exercise_2 = f"Vraag:\n{question}\n\n{distractors[0]}\n{answer} ✔\n{distractors[1]}\n{distractors[2]}\n\n\n\n---------------------\nBonus-afleider:\n{distractors[3]}\n\n---------------------\nOf maak er een 'Beide bovenstaande'-vraag van:\nBeide bovenstaande\nGeen van bovenstaande\n\nExtra info:\n{Takeaway}"
|
263 |
-
exercise_3 = f"Vraag:\n{question}\n\n{distractors[0]}\n{distractors[1]}\n{answer} ✔\n{distractors[2]}\n\n\n\n---------------------\nBonus-afleider:\n{distractors[3]}\n\n---------------------\nOf maak er een 'Beide bovenstaande'-vraag van:\nBeide bovenstaande\nGeen van bovenstaande\n\nExtra info:\n{Takeaway}"
|
264 |
-
exercise_4 = f"Vraag:\n{question}\n\n{distractors[0]}\n{distractors[1]}\n{distractors[2]}\n{answer} ✔\n\n\n\n---------------------\nBonus-afleider:\n{distractors[3]}\n\n---------------------\nOf maak er een 'Beide bovenstaande'-vraag van:\nBeide bovenstaande\nGeen van bovenstaande\n\nExtra info:\n{Takeaway}"
|
265 |
|
266 |
-
|
267 |
-
|
268 |
-
# Randomly choose between OneTrue and NoneTrue based on the probabilities
|
269 |
-
random_version = random.choices([exercise_1, exercise_2, exercise_3, exercise_4], weights=probabilities, k=1)[0]
|
270 |
|
271 |
-
return random_version
|
272 |
-
|
273 |
|
274 |
-
inputs = gr.Textbox(lines=7, label="Input")
|
275 |
-
outputs = gr.Textbox(label="Output")
|
276 |
|
277 |
-
# Create the Gradio interface
|
278 |
iface = gr.Interface(
|
279 |
-
fn=
|
280 |
-
inputs=
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
)
|
287 |
|
288 |
-
iface.launch(share=True)
|
|
|
|
3 |
import gradio as gr
|
4 |
import os
|
5 |
|
|
|
6 |
openai.api_key = os.environ["OpenAPI_Key"]
|
7 |
|
8 |
+
manual = r"""Input your variables in the fields on the left. The last one (Extra input...) is optional, you can use it to steer the prompt into a certain direction by adding more requirements.
|
9 |
+
"""
|
10 |
|
11 |
+
# Define the messages for step_1
|
12 |
+
SystemPrompt_10 = r""""You are a script writer and prompt engineer creating engaging YouTube tutorial scripts on how to use ChatGPT for various tasks in a corporate environment.
|
13 |
|
14 |
+
Make sure to include what sort of information the user needs to type into the prompt.
|
15 |
|
16 |
+
When creating the script, please follow this structure:
|
17 |
+
- Hook
|
18 |
+
- Title
|
19 |
+
- Introduction
|
20 |
+
- Learning Objectives Summary
|
21 |
+
- Learning Objective 1
|
22 |
+
- Learning Objective 2
|
23 |
+
- Conclusion
|
24 |
|
25 |
+
Feel free to be creative."""
|
26 |
+
UserPrompt_10 = r""""Create a script for teaching an employee: How to create a Job Ad with ChatGPT.
|
27 |
+
Additional instructions: Use digital marketing manager as an example role."""
|
28 |
+
AssistantPrompt_10 = r""""*HOOK*
|
29 |
+
If you want your job ads to be found by the right candidates, you have to incorporate the right SEO-friendly keywords.
|
30 |
|
31 |
+
But how do you accomplish this without a lot of experience in Search Engine Optimization?
|
|
|
32 |
|
33 |
+
Well, with ChatGPT.
|
34 |
|
35 |
+
*TITLE*
|
36 |
+
Create a Job Ad with ChatGPT
|
37 |
|
38 |
+
*INTRO*
|
39 |
+
In this digital age, getting your job ad to stand out amongst the rest is crucial to finding the best candidates.
|
40 |
|
41 |
+
Today, we'll show you how to use ChatGPT to create a job ad that not only resonates with your ideal candidates, but also ranks high with SEO-friendly keywords.
|
|
|
|
|
|
|
42 |
|
43 |
+
*LEARNING OBJECTIVES SUMMARY*
|
44 |
+
You will learn how to:
|
45 |
|
46 |
+
- Create an ideal job description
|
|
|
|
|
|
|
47 |
|
48 |
+
- Extract SEO Friendly Keywords
|
|
|
49 |
|
50 |
+
- Craft a Job Ad
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
+
Let's dive right in!
|
53 |
+
|
54 |
+
*LEARNING OBJECTIVE 1*
|
55 |
+
You can't create the perfect job ad without first creating the job description.
|
56 |
+
|
57 |
+
Creating a comprehensive job description is critical for attracting the right candidates, setting expectations, and ensuring both the employee and employer understand the role's responsibilities.
|
58 |
+
|
59 |
+
To create a basic job description, you would at least need to define the job title, the overview of the role, and the role's key responsibilities.
|
60 |
+
|
61 |
+
It's also preferable to already identify any other details about the role, like qualifications and skills, experience level, salary and benefits, reporting structure, and working hours.
|
62 |
+
|
63 |
+
Let's say you've been tasked to recruit a 'Digital Marketing Manager'.
|
64 |
+
|
65 |
+
Gather as much information as you can on the specifics of this job from the person that made the request.
|
66 |
+
|
67 |
+
For this tutorial, we'll be using the following sample information.
|
68 |
+
|
69 |
+
|
70 |
+
The job title is "Digital marketing manager."
|
71 |
+
|
72 |
+
The overview of the role is "The digital marketing manager is responsible for managing the overall digital marketing strategy of xpedite.ai. He/she is also responsible for:
|
73 |
+
- overseeing online marketing campaigns and other digital projects to optimize online brand presence and boost revenue.
|
74 |
+
- manageing a team of 3 digital marketers."
|
75 |
+
|
76 |
+
The key responsibilities of the role are "propose and execute digital marketing strategies, manage and oversee digital channels, monitor and measure ROI and KPIs of online campaigns."
|
77 |
+
|
78 |
+
Now, we're ready to write our prompt.
|
79 |
+
|
80 |
+
Type: "You are a recruiter. Create a job description for a digital marketing manager.
|
81 |
+
|
82 |
+
|
83 |
+
Here are some additional details to consider when writing the job description:"
|
84 |
+
|
85 |
+
Then, paste the details you gathered previously.
|
86 |
+
|
87 |
+
Then press the send button.
|
88 |
+
|
89 |
+
ChatGPT wrote some basic details, the overview of the role, and key responsibilities of the role.
|
90 |
+
|
91 |
+
It also included [basic and preferred qualifications], [what's in it for the applicant], and [more instructions].
|
92 |
+
|
93 |
+
|
94 |
+
Make sure to review and revise this job description so it effectively communicates your expectations.
|
95 |
+
|
96 |
+
*LEARNING OBJECTIVE 2*
|
97 |
+
With this description, we can proceed to extract keywords which potential candidates might use when searching for this job.
|
98 |
+
|
99 |
+
Keywords are important because they make your job ad discoverable. The best keywords should resonate with the job seekers' search behavior.
|
100 |
+
|
101 |
+
Let's get keywords from ChatGPT.
|
102 |
+
|
103 |
+
Type "Provide keywords related to the role of Digital Marketing Manager based on the description you've provided me."
|
104 |
+
|
105 |
+
Then, press the send message button.
|
106 |
+
|
107 |
+
ChatGPT came up with a couple of keywords that we can use when posting our final job ad.
|
108 |
+
|
109 |
+
We can also incorporate these keywords into the job ad itself.
|
110 |
+
|
111 |
+
With our description and keywords in hand, let's craft a job ad that integrates them both seamlessly.
|
112 |
+
|
113 |
+
Type:
|
114 |
+
|
115 |
+
"Using the job description and the keywords you've provided, draft a job ad for a Digital Marketing Manager."
|
116 |
+
|
117 |
+
Then, press the send button.
|
118 |
+
|
119 |
+
Here's the response.
|
120 |
+
|
121 |
+
|
122 |
+
ChatGPT drafted a job ad that contains specific details about the job description and incorporates keywords so that it's easier to find on the internet.
|
123 |
+
|
124 |
+
Make sure to review and revise the ad and verify that all information is accurate before posting it online.
|
125 |
+
|
126 |
+
*CONCLUSION*
|
127 |
+
That's it!
|
128 |
+
|
129 |
+
By leveraging the power of ChatGPT-4, HR professionals can create job advertisements that stand out and attract top talent.
|
130 |
+
|
131 |
+
Remember, in the digital age of recruitment, your job ad is your first impression. So make it count!"""
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
# Function to make API call
|
135 |
def api_call(messages, temperature=0.9, model="gpt-4"):
|
|
|
140 |
).choices[0].message.content
|
141 |
|
142 |
# Function to be called by Gradio interface
|
143 |
+
def process_inputs(EPA_title, Department, Extra_input):
|
144 |
+
# Check if EPA_title and/or Department are empty
|
145 |
+
if not EPA_title and not Department:
|
146 |
return manual
|
147 |
+
else:
|
|
|
148 |
# Step 1: User input and first API call ~5secs
|
149 |
stepOne = [
|
150 |
+
{"role": "system", "content": SystemPrompt_10},
|
151 |
+
{"role": "user", "content": UserPrompt_10},
|
152 |
+
{"role": "assistant", "content": AssistantPrompt_10},
|
153 |
+
{"role": "user", "content": f"""Create a script for teaching an employee: {EPA_title}
|
154 |
+
The target audience is: a professional in a {Department} team.
|
155 |
+
Additional instructions: {Extra_input}"""}
|
|
|
|
|
156 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
+
Script_1 = api_call(stepOne, 0.7)
|
159 |
+
return Script_1
|
|
|
|
|
160 |
|
|
|
|
|
161 |
|
|
|
|
|
162 |
|
163 |
+
# Create the Gradio interface
|
164 |
iface = gr.Interface(
|
165 |
+
fn=process_inputs,
|
166 |
+
inputs=[
|
167 |
+
gr.Textbox(lines=2, label="EPA title Here..."),
|
168 |
+
gr.Textbox(lines=2, label="Department Here..."),
|
169 |
+
gr.Textbox(lines=2, label="Extra input Here... (optional)")
|
170 |
+
],
|
171 |
+
outputs=gr.Textbox(label="Script", show_copy_button=True)
|
172 |
)
|
173 |
|
174 |
+
iface.launch(share=True)
|
175 |
+
iface.launch()
|