LinJulya commited on
Commit
a5168ec
·
1 Parent(s): c8f8e02

Edited the markdown for better instructions

Browse files
Files changed (1) hide show
  1. app.py +17 -95
app.py CHANGED
@@ -19,17 +19,29 @@ step1Statement = (
19
  """
20
  ## Step 1. Answer these questions
21
  In order for us to create the script for you, first you need to answer some very important questions.
22
- Make sure to answer these questions in a clear and detailed manner. After answering the questions, press the "Review Answers" button.
23
  Check the feedback given in the review and apply them accordingly.
24
- Once you are satisfied, press the "Let's Start" button.
 
 
 
 
 
 
 
 
 
 
 
 
25
  """
26
  )
27
 
28
  step2Statement = (
29
  """
30
  ## Step 2. Review each output
31
- In this section, review the result in each substep in order. If you are not happy with the results, press the "Regenerate Current Step" button
32
- until you are happy. Then, you can press the "Generate Next Step Button." This button will generate the next section.
33
  """
34
  )
35
 
@@ -42,88 +54,6 @@ step3Statement = (
42
  )
43
 
44
 
45
- # Classes
46
- class FormStep:
47
-
48
- def __init__(self, label):
49
-
50
- self.txtBoxTxt = label
51
- self._id = 1
52
-
53
- with gr.Blocks(theme=gr.themes.Soft()) as self.demo:
54
- with gr.Column():
55
- self.output = gr.Textbox(label=label)
56
- with gr.Row():
57
- self.approveBtn = gr.Button("Approve", interactive=False)
58
- self.rejectBtn = gr.Button("Reject", interactive=False)
59
-
60
-
61
- def enableBtn(self, bool):
62
- print("FormStep, enableBtn")
63
- self.approveBtn.interactive = bool
64
- self.rejectBtn.interactive = bool
65
-
66
- def set_btn(self, btnManager, inputs, output, approveFunc, rejectFunc):
67
- self.btnManager = btnManager
68
- self.inputs = inputs
69
- self.output = output
70
- self.approveFunc = approveFunc
71
- self.rejectFunc = rejectFunc
72
- self.approveBtn.click(fn=self.approveFunc, inputs=self.inputs, outputs=self.output)
73
- self.rejectBtn.click(fn=self.rejectFunc, inputs=self.inputs, outputs=self.output)
74
-
75
-
76
- def launch(self):
77
- self.demo.launch()
78
-
79
-
80
- class HorizontalBtn:
81
-
82
- def __init__(self, label):
83
- self.label = label
84
-
85
- with gr.Blocks() as self.demo:
86
- self.btn = gr.Button(label, interactive=False)
87
-
88
- def set_btn(self, btnManager, inputs, outputs, func):
89
- self.btnManager = btnManager
90
- self.inputs = inputs
91
- self.outputs = outputs
92
- self.func = func
93
- self.btn.click(fn=func, inputs=inputs, outputs=outputs)
94
-
95
-
96
- def enableBtn(self, bool):
97
- self.btn.interactive = bool
98
-
99
- def launch(self):
100
- self.demo.launch()
101
-
102
-
103
- class ButtonManager:
104
- def __init__(self, start, step2a, step2b, step2c, step2d, restart):
105
- self.buttons = {
106
- 'start': start,
107
- 'step2a': step2a,
108
- 'step2b': step2b,
109
- 'step2c': step2c,
110
- 'step2d': step2d,
111
- 'restart': restart
112
- }
113
-
114
- """
115
-
116
- def enable_button(self, button_name):
117
- print("enable_button: btnManager")
118
- if button_name in self.buttons:
119
- self.buttons[button_name].enableBtn(True)
120
- print("enable_button: button_name: btnManager")
121
-
122
- def disable_button(self, button_name):
123
- if button_name in self.buttons:
124
- self.buttons[button_name].enableBtn(False) """
125
-
126
-
127
  # Final Global Vars
128
  Hook = ""
129
  TitleAndIntro = ""
@@ -155,7 +85,6 @@ def GenerateHook(audienceInput, problemInput, solutionInput, objectiveInput, rev
155
  else:
156
 
157
  global client
158
- client = OpenAI()
159
 
160
  user_message_content = (
161
  f"Target Audience: {audienceInput}\n"
@@ -225,7 +154,6 @@ def GenerateTitleAndIntro(audienceInput, problemInput, solutionInput, objectiveI
225
  else:
226
 
227
  global client
228
- client = OpenAI()
229
 
230
  user_message_content = (
231
  f"Target Audience: {audienceInput}\n"
@@ -296,7 +224,6 @@ def GenerateLearningObjectives(audienceInput, problemInput, solutionInput, objec
296
  else:
297
 
298
  global client
299
- client = OpenAI()
300
 
301
  user_message_content = (
302
  f"Target Audience: {audienceInput}\n"
@@ -368,7 +295,6 @@ def GeneratePrompts(audienceInput, problemInput, solutionInput, objectiveInput,
368
  else:
369
 
370
  global client
371
- client = OpenAI()
372
 
373
  user_message_content = (
374
  f"Target Audience: {audienceInput}\n"
@@ -429,7 +355,6 @@ def GenerateTutorialSections(objectiveInput, learningObjectiveBox, promptBox):
429
  else:
430
 
431
  global client
432
- client = OpenAI()
433
 
434
  user_message_content = (
435
  f"Video Objective: {objectiveInput}\n"
@@ -512,7 +437,6 @@ def ReviewAnswers(audienceInput, problemInput, solutionInput, objectiveInput):
512
  else:
513
 
514
  global client
515
- client = OpenAI()
516
 
517
  user_message_content = (
518
  f"Target Audience: {audienceInput}\n"
@@ -550,7 +474,6 @@ def ReviewAnswers(audienceInput, problemInput, solutionInput, objectiveInput):
550
 
551
  review = response.choices[0].message.content
552
  return review
553
-
554
  # Main
555
  with gr.Blocks(theme=gr.themes.Soft()) as main:
556
  with gr.Column():
@@ -655,5 +578,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as main:
655
 
656
 
657
  # Launch
658
- main.launch()
659
-
 
19
  """
20
  ## Step 1. Answer these questions
21
  In order for us to create the script for you, first you need to answer some very important questions.
22
+ Make sure to answer these questions in a clear and detailed manner. After answering the questions, press the <span style="color:orange">**Review Answers**</span> button.
23
  Check the feedback given in the review and apply them accordingly.
24
+ Once you are satisfied, press the <span style="color:green">**Let's Start**</span> button. \n\n
25
+
26
+ <details>
27
+ <summary>Click here to see some examples</summary>
28
+
29
+ | Input | Good Inputs | Bad Inputs |
30
+ |---------------|---------------|---------------|
31
+ | Audience | HR recruiters | Employees |
32
+ | Problem | HR Recruiters have the problem of crafting job ads that are clear, engaging, and appealing to the ideal candidates. Many job ads fail to capture the essence of the role or the company culture, resulting in a mismatch of applications and missed opportunities to attract top talent. | Creating job ads takes time |
33
+ | Solution | ChatGPT can assist in generating clear, and inclusive job descriptions by providing suggestions on language, structure, and content. It can help ensure the job ad is free from biased language, aligns with the company's values, and speaks directly to the desired audience. | ChatGPT can help in creating job ads |
34
+ | Video Objective | The objective of the video is to teach HR Recruiters how to use ChatGPT to: 1) create a draft of a job ad that is clear, free from biased language, aligns with company values, and speaks directly to the target audience. | Teach people how to make job ads |
35
+
36
+ </details>
37
  """
38
  )
39
 
40
  step2Statement = (
41
  """
42
  ## Step 2. Review each output
43
+ In this section, review the result in each substep in order. If you are not happy with the results, press the **Regenerate Current Step** button
44
+ until you are happy. Then, you can press the **Generate Next Step Button.** This button will generate the next section.
45
  """
46
  )
47
 
 
54
  )
55
 
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  # Final Global Vars
58
  Hook = ""
59
  TitleAndIntro = ""
 
85
  else:
86
 
87
  global client
 
88
 
89
  user_message_content = (
90
  f"Target Audience: {audienceInput}\n"
 
154
  else:
155
 
156
  global client
 
157
 
158
  user_message_content = (
159
  f"Target Audience: {audienceInput}\n"
 
224
  else:
225
 
226
  global client
 
227
 
228
  user_message_content = (
229
  f"Target Audience: {audienceInput}\n"
 
295
  else:
296
 
297
  global client
 
298
 
299
  user_message_content = (
300
  f"Target Audience: {audienceInput}\n"
 
355
  else:
356
 
357
  global client
 
358
 
359
  user_message_content = (
360
  f"Video Objective: {objectiveInput}\n"
 
437
  else:
438
 
439
  global client
 
440
 
441
  user_message_content = (
442
  f"Target Audience: {audienceInput}\n"
 
474
 
475
  review = response.choices[0].message.content
476
  return review
 
477
  # Main
478
  with gr.Blocks(theme=gr.themes.Soft()) as main:
479
  with gr.Column():
 
578
 
579
 
580
  # Launch
581
+ main.launch()