BtB-ExpC commited on
Commit
5431ba3
·
1 Parent(s): d86f48b

all eventualities covered in for loops

Browse files
Files changed (1) hide show
  1. app.py +57 -9
app.py CHANGED
@@ -199,15 +199,14 @@ def process_inputs(EPA_title, Extra_input, Department):
199
  # Check if EPA_title is empty
200
  if not EPA_title:
201
  return manual
202
- if not Extra_input:
203
  stepOne = [
204
  {"role": "system", "content": SystemPrompt_10},
205
  {"role": "user", "content": UserPrompt_10},
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 in a {Department} department."""}
211
  ]
212
  Script_1st_half = api_call(stepOne, 0.7)
213
 
@@ -216,15 +215,63 @@ def process_inputs(EPA_title, Extra_input, Department):
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 in a {Department} department.
220
 
221
- {Script_1st_half}"""}
222
  ]
223
  Script_2nd_half = api_call(stepTwo, 0.7)
224
  Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
225
  return Script_complete
 
 
 
 
 
 
 
 
 
 
 
226
 
227
- else:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  # Step 1: User input and first API call ~5secs
229
  stepOne = [
230
  {"role": "system", "content": SystemPrompt_10},
@@ -232,9 +279,9 @@ def process_inputs(EPA_title, Extra_input, Department):
232
  {"role": "assistant", "content": AssistantPrompt_10},
233
  {"role": "user", "content": UserPrompt_11},
234
  {"role": "assistant", "content": AssistantPrompt_11},
235
- {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
236
- Additional instructions: {Extra_input}
237
- The tutorial is aimed at employees in a {Department} department."""}
238
  ]
239
  Script_1st_half = api_call(stepOne, 0.7)
240
 
@@ -252,6 +299,7 @@ def process_inputs(EPA_title, Extra_input, Department):
252
  Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
253
  return Script_complete
254
 
 
255
  departments = {
256
  "3D": "3D Modeling", # Label and value differ
257
  "Client Support": "Client Support",
 
199
  # Check if EPA_title is empty
200
  if not EPA_title:
201
  return manual
202
+ if not Extra_input and not Department:
203
  stepOne = [
204
  {"role": "system", "content": SystemPrompt_10},
205
  {"role": "user", "content": UserPrompt_10},
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
  ]
211
  Script_1st_half = api_call(stepOne, 0.7)
212
 
 
215
  {"role": "user", "content": UserPrompt_20},
216
  {"role": "assistant", "content": AssistantPrompt_20},
217
  {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
 
218
 
219
+ {Script_1st_half}"""}
220
  ]
221
  Script_2nd_half = api_call(stepTwo, 0.7)
222
  Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
223
  return Script_complete
224
+ if Extra_input and not Department:
225
+ stepOne = [
226
+ {"role": "system", "content": SystemPrompt_10},
227
+ {"role": "user", "content": UserPrompt_10},
228
+ {"role": "assistant", "content": AssistantPrompt_10},
229
+ {"role": "user", "content": UserPrompt_11},
230
+ {"role": "assistant", "content": AssistantPrompt_11},
231
+ {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
232
+ Additional instructions: {Extra_input}"""}
233
+ ]
234
+ Script_1st_half = api_call(stepOne, 0.7)
235
 
236
+ stepTwo = [
237
+ {"role": "system", "content": SystemPrompt_20},
238
+ {"role": "user", "content": UserPrompt_20},
239
+ {"role": "assistant", "content": AssistantPrompt_20},
240
+ {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
241
+ Additional instructions: {Extra_input}
242
+
243
+ {Script_1st_half}"""}
244
+ ]
245
+ Script_2nd_half = api_call(stepTwo, 0.7)
246
+ Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
247
+ return Script_complete
248
+
249
+ if Department and not Extra_input:
250
+ stepOne = [
251
+ {"role": "system", "content": SystemPrompt_10},
252
+ {"role": "user", "content": UserPrompt_10},
253
+ {"role": "assistant", "content": AssistantPrompt_10},
254
+ {"role": "user", "content": UserPrompt_11},
255
+ {"role": "assistant", "content": AssistantPrompt_11},
256
+ {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
257
+ The tutorial is aimed at employees in a {Department} department."""}
258
+ ]
259
+ Script_1st_half = api_call(stepOne, 0.7)
260
+
261
+ stepTwo = [
262
+ {"role": "system", "content": SystemPrompt_20},
263
+ {"role": "user", "content": UserPrompt_20},
264
+ {"role": "assistant", "content": AssistantPrompt_20},
265
+ {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}
266
+ The tutorial is aimed at employees in a {Department} department.
267
+
268
+ {Script_1st_half}"""}
269
+ ]
270
+ Script_2nd_half = api_call(stepTwo, 0.7)
271
+ Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
272
+ return Script_complete
273
+
274
+ else: # All fields filled out
275
  # Step 1: User input and first API call ~5secs
276
  stepOne = [
277
  {"role": "system", "content": SystemPrompt_10},
 
279
  {"role": "assistant", "content": AssistantPrompt_10},
280
  {"role": "user", "content": UserPrompt_11},
281
  {"role": "assistant", "content": AssistantPrompt_11},
282
+ {"role": "user", "content": f"""Topic of the tutorial: {EPA_title}.
283
+ Additional instructions: {Extra_input}.
284
+ The tutorial is aimed at employees in a {Department} department."""}
285
  ]
286
  Script_1st_half = api_call(stepOne, 0.7)
287
 
 
299
  Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
300
  return Script_complete
301
 
302
+
303
  departments = {
304
  "3D": "3D Modeling", # Label and value differ
305
  "Client Support": "Client Support",