Spaces:
Runtime error
Runtime error
wordings
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ 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
|
| 9 |
"""
|
| 10 |
|
| 11 |
# Define the messages for step_1
|
|
@@ -207,7 +207,7 @@ def process_inputs(EPA_title, Extra_input, Department):
|
|
| 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
|
| 211 |
]
|
| 212 |
Script_1st_half = api_call(stepOne, 0.7)
|
| 213 |
|
|
@@ -216,7 +216,7 @@ 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
|
| 220 |
]
|
| 221 |
Script_2nd_half = api_call(stepTwo, 0.7)
|
| 222 |
Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
|
|
@@ -232,7 +232,7 @@ def process_inputs(EPA_title, Extra_input, Department):
|
|
| 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
|
| 236 |
]
|
| 237 |
Script_1st_half = api_call(stepOne, 0.7)
|
| 238 |
|
|
@@ -242,7 +242,7 @@ def process_inputs(EPA_title, Extra_input, Department):
|
|
| 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
|
| 246 |
|
| 247 |
{Script_1st_half}"""}
|
| 248 |
]
|
|
@@ -275,7 +275,7 @@ departments = {
|
|
| 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
|
| 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 |
],
|
|
|
|
| 5 |
|
| 6 |
openai.api_key = os.environ["OpenAPI_Key"]
|
| 7 |
|
| 8 |
+
manual = r"""Input your variables in the fields on the left. The last two (Extra input and Team) are optional, but recommended. 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
|
|
|
|
| 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 |
{"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_2nd_half = api_call(stepTwo, 0.7)
|
| 222 |
Script_complete = Script_1st_half + "\n\n" + Script_2nd_half
|
|
|
|
| 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 in 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 in a {Department} department.
|
| 246 |
|
| 247 |
{Script_1st_half}"""}
|
| 248 |
]
|
|
|
|
| 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 using 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 |
],
|