BtB-ExpC commited on
Commit
e4ddcc0
·
1 Parent(s): 6a21794

Dropdown menu for department added

Browse files
Files changed (1) hide show
  1. app.py +38 -11
app.py CHANGED
@@ -19,7 +19,7 @@ The structure of the script will look like this:
19
  - Conclusion
20
 
21
  You'll only focus on the Hook, Title and Intro. Here are instructions for each:
22
-
23
  The hook has only two goals, it must:
24
  1. Catch the audience's attention and convince them to watch more of the video.
25
  2. Serve as a setup for the video's content.
@@ -184,9 +184,10 @@ By leveraging the power of ChatGPT-4, HR professionals can create job advertisem
184
 
185
  Remember, in the digital age of recruitment, your job ad is your first impression. So make it count!"""
186
 
 
187
  # Function to make API call
188
  def api_call(messages, temperature=0.9, model="gpt-4-1106-preview"):
189
- return openai.ChatCompletion.create(
190
  messages=messages,
191
  temperature=temperature,
192
  model=model
@@ -194,7 +195,7 @@ def api_call(messages, temperature=0.9, model="gpt-4-1106-preview"):
194
 
195
 
196
  # Function to be called by Gradio interface
197
- def process_inputs(EPA_title, Extra_input):
198
  # Check if EPA_title is empty
199
  if not EPA_title:
200
  return manual
@@ -205,7 +206,8 @@ def process_inputs(EPA_title, Extra_input):
205
  {"role": "assistant", "content": AssistantPrompt_10},
206
  {"role": "user", "content": UserPrompt_11},
207
  {"role": "assistant", "content": AssistantPrompt_11},
208
- {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}"""}
 
209
  ]
210
  Script_1st_half = api_call(stepOne, 0.7)
211
 
@@ -213,7 +215,8 @@ def process_inputs(EPA_title, Extra_input):
213
  {"role": "system", "content": SystemPrompt_20},
214
  {"role": "user", "content": UserPrompt_20},
215
  {"role": "assistant", "content": AssistantPrompt_20},
216
- {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}"""}
 
217
  ]
218
  Script_2nd_half = api_call(stepTwo, 0.7)
219
  Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
@@ -228,7 +231,8 @@ def process_inputs(EPA_title, Extra_input):
228
  {"role": "user", "content": UserPrompt_11},
229
  {"role": "assistant", "content": AssistantPrompt_11},
230
  {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
231
- Additional instructions: {Extra_input}"""}
 
232
  ]
233
  Script_1st_half = api_call(stepOne, 0.7)
234
 
@@ -238,20 +242,43 @@ def process_inputs(EPA_title, Extra_input):
238
  {"role": "assistant", "content": AssistantPrompt_20},
239
  {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
240
  Additional instructions: {Extra_input}
241
-
 
242
  {Script_1st_half}"""}
243
  ]
244
  Script_2nd_half = api_call(stepTwo, 0.7)
245
  Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
246
  return Script_complete
247
 
248
- # Create the Gradio interface
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  iface = gr.Interface(
250
- fn=process_inputs,
251
  inputs=[
252
  gr.Textbox(lines=2, label='EPA title Here... (use the phrasing: "How to do X with ChatGPT")'),
253
- gr.Textbox(lines=2, label='Extra input Here... (optional, put any extra requirements or relevant context)')
254
- ],
 
255
  outputs=gr.Textbox(label="Script", show_copy_button=True)
256
  )
257
 
 
19
  - Conclusion
20
 
21
  You'll only focus on the Hook, Title and Intro. Here are instructions for each:
22
+
23
  The hook has only two goals, it must:
24
  1. Catch the audience's attention and convince them to watch more of the video.
25
  2. Serve as a setup for the video's content.
 
184
 
185
  Remember, in the digital age of recruitment, your job ad is your first impression. So make it count!"""
186
 
187
+
188
  # Function to make API call
189
  def api_call(messages, temperature=0.9, model="gpt-4-1106-preview"):
190
+ return openai.ChatCompletion.create(
191
  messages=messages,
192
  temperature=temperature,
193
  model=model
 
195
 
196
 
197
  # Function to be called by Gradio interface
198
+ def process_inputs(EPA_title, Extra_input, Department):
199
  # Check if EPA_title is empty
200
  if not EPA_title:
201
  return manual
 
206
  {"role": "assistant", "content": AssistantPrompt_10},
207
  {"role": "user", "content": UserPrompt_11},
208
  {"role": "assistant", "content": AssistantPrompt_11},
209
+ {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
210
+ The tutorial should be aimed at employees at a {Department} department."""}
211
  ]
212
  Script_1st_half = api_call(stepOne, 0.7)
213
 
 
215
  {"role": "system", "content": SystemPrompt_20},
216
  {"role": "user", "content": UserPrompt_20},
217
  {"role": "assistant", "content": AssistantPrompt_20},
218
+ {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
219
+ The tutorial should be aimed at employees at a {Department} department."""}
220
  ]
221
  Script_2nd_half = api_call(stepTwo, 0.7)
222
  Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
 
231
  {"role": "user", "content": UserPrompt_11},
232
  {"role": "assistant", "content": AssistantPrompt_11},
233
  {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
234
+ Additional instructions: {Extra_input}
235
+ The tutorial is aimed at employees at a {Department} department."""}
236
  ]
237
  Script_1st_half = api_call(stepOne, 0.7)
238
 
 
242
  {"role": "assistant", "content": AssistantPrompt_20},
243
  {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
244
  Additional instructions: {Extra_input}
245
+ The tutorial is aimed at employees at a {Department} department.
246
+
247
  {Script_1st_half}"""}
248
  ]
249
  Script_2nd_half = api_call(stepTwo, 0.7)
250
  Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
251
  return Script_complete
252
 
253
+ departments = {
254
+ "3D": "3D Modeling", # Label and value differ
255
+ "Client Support": "Client Support",
256
+ "Data Entry & Back Office": "Data Entry & Back Office",
257
+ "Education Administration (ENI)": "Education Administration", # Label and value differ
258
+ "Finance": "Finance",
259
+ "Marketing": "Marketing",
260
+ "HR": "HR",
261
+ "IT": "IT",
262
+ "Legal": "Legal",
263
+ "Product Management": "Product Management",
264
+ "Project Management/Coordination": "Project Management/Coordination",
265
+ "Process Management": "Process Management",
266
+ "QA": "QA",
267
+ "R&D": "R&D",
268
+ "Sales": "Sales",
269
+ "Software": "Software",
270
+ "Video Production": "Video Production",
271
+ "Visual Management": "Visual Management"
272
+ }
273
+
274
+ # Create the Gradio interface
275
  iface = gr.Interface(
276
+ fn=process_inputs,
277
  inputs=[
278
  gr.Textbox(lines=2, label='EPA title Here... (use the phrasing: "How to do X with ChatGPT")'),
279
+ gr.Textbox(lines=2, label='Extra input Here... (optional, put any extra requirements or relevant context)'),
280
+ gr.Dropdown(choices=departments, label="Select Team", searchable=True)
281
+ ],
282
  outputs=gr.Textbox(label="Script", show_copy_button=True)
283
  )
284