Spaces:
Running
Running
from openai import OpenAI | |
import random | |
import gradio as gr | |
import os | |
import re | |
client = OpenAI(api_key=os.environ.get('OPENAI_API_KEY')) | |
# Variables | |
introStatement = ( | |
""" | |
# ChatGPT Use Case Script Generator | |
Welcome to the ChatGPT Use Case Script Generator! With this tool, you can create any ChatGPT Use Case script that you want. | |
To use the tool, you will find instructions in every step. Make sure to read and follow these instructions to get the best results. | |
Good luck! | |
""" | |
) | |
step1Statement = ( | |
""" | |
## Step 1. Answer these questions | |
In order for us to create the script for you, first you need to answer some very important questions. | |
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. | |
Check the feedback given in the review and apply them accordingly. | |
Once you are satisfied, press the <span style="color:green">**Let's Start**</span> button. \n\n | |
<details> | |
<summary>Click here to see some examples</summary> | |
| Input | Good Inputs | Bad Inputs | | |
|---------------|---------------|---------------| | |
| Audience | HR recruiters | Employees | | |
| 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 | | |
| 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 | | |
| 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 | | |
</details> | |
""" | |
) | |
step2Statement = ( | |
""" | |
## Step 2. Review each output | |
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 | |
until you are happy. Then, you can press the **Generate Next Step** button. This button will generate the next section. | |
""" | |
) | |
step3Statement = ( | |
""" | |
## Step 3. Copy your script | |
And that's it! Copy your script and paste it wherever you need to paste it. | |
Need to make a new script? Simply press the refresh button. | |
""" | |
) | |
# Final Global Vars | |
Hook = "" | |
TitleAndIntro = "" | |
LearningObjectives = "" | |
Prompts = "" | |
TutorialSections = "" | |
FinalScript = "" | |
#All Functions | |
#Generate Hook Function | |
#This function takes all four inputs from the text box and uses them to create a hook | |
def GenerateHook(audienceInput, problemInput, solutionInput, objectiveInput, reviewAnswersBox): | |
global Hook #Declare as global | |
inputs = { | |
"Audience Input": audienceInput, | |
"Problem Input": problemInput, | |
"Solution Input": solutionInput, | |
"Objective Input": objectiveInput, | |
"Review": reviewAnswersBox | |
} | |
empty_inputs = [name for name, value in inputs.items() if not value] | |
def check_reviews(reviewAnswersBox): | |
# Define the pattern to search for ratings | |
pattern = r'\b\d+/5\b' | |
# Find all instances of the pattern in the review text | |
ratings = re.findall(pattern, reviewAnswersBox) | |
# Check if all found ratings are 5/5 and ensure there are exactly 4 ratings | |
if len(ratings) == 4 and all(rating == '5/5' for rating in ratings): | |
return True | |
else: | |
return False | |
if empty_inputs: | |
return ( """Please make sure to fill in these empty inputs: \n""" + "\n".join(empty_inputs)) | |
else: | |
if check_reviews(reviewAnswersBox): | |
global client | |
user_message_content = ( | |
f"Target Audience: {audienceInput}\n" | |
f"Problem: {problemInput}\n" | |
f"Solution: {solutionInput}\n" | |
f"Video Objective: {objectiveInput}" | |
) | |
response = client.chat.completions.create( | |
model="gpt-4", | |
messages=[ | |
{ | |
"role": "system", | |
"content": "You are an expert script writer creating engaging YouTube tutorial scripts for beginners on how to use ChatGPT to solve the problems they encounter in the corporate environment. These scripts must be written in a simple conversational manner and targeted to a beginner of a specific target audience. Technical jargon and complex words must be avoided at all times. \n\nYour current task is to create a hook based on the script brief. The hook is designed to show the viewer what their problem is and how watching the video will help them with their problem. During the hook, we need to welcome the audience, present their SPECIFIC problem, and how SPECIFICALLY their problem can be solved with ChatGPT. Finally, we offer for them to keep watching so we can show them how." | |
}, | |
{ | |
"role": "user", | |
"content": "Target Audience: members of the social media marketing team.\nProblem: Members of the marketing team come up with a text content to post on social media, but it doesn't always match the company's brand voice. \nSolution: With ChatGPT, they can use a prompt to check if their content matches their brand voice and provide suggestions. \nVideo Objective: The objective of the video is to teach the viewer how to use ChatGPT to review social media text content to check if it matches the brand voice. " | |
}, | |
{ | |
"role": "assistant", | |
"content": "Hello, social media marketers! Ever whipped up a killer piece of content only to realize it just seems... off-brand? What if you could run a quality check to ensure your message is always in line with your company's brand voice? Let me introduce you to your new best friend, ChatGPT! This savvy tool can check your content before you post and offer suggestions to better align with your brand. Keep watching, and we'll show you how." | |
}, | |
{ | |
"role": "user", | |
"content": "Target Audience: members of the sales team.\nProblem: Members of the sales team often spend a lot of time creating personalized emails for customers in different sales scenarios. \nSolution: With ChatGPT, they can use a prompt and create email templates for different sales scenarios. \nVideo Objective: The objective of the video is to teach the viewer how to use ChatGPT to create email templates for customers and various sales scenarios, so they no longer need to write emails from scratch every single time. " | |
}, | |
{ | |
"role": "assistant", | |
"content": "Hey sales pros! Isn't it exhausting to constantly craft unique emails for every different sales scenario? Imagine having a magic tool that helps you create personalized email templates in a snap! Sounds good, right? That tool is called ChatGPT. With it, you can easily create tailor-made email templates for your customers in no time, guaranteeing you never have to start from scratch again. Stick with us in this video, and we'll show you how to turn those long hours into mere minutes." | |
}, | |
{ | |
"role": "user", | |
"content": user_message_content | |
} | |
], | |
temperature=1, | |
max_tokens=256, | |
top_p=1, | |
frequency_penalty=0, | |
presence_penalty=0 | |
) | |
Hook = response.choices[0].message.content | |
return Hook | |
else: | |
return "Not all questions received a 5/5 rating and this may affect the quality of the script π. Please try again." | |
#Generate Title and Intro Function | |
#This function takes all four inputs from the text box and uses them to create a title and intro | |
#Before running, it makes sure that the hook has already been generated | |
def GenerateTitleAndIntro(audienceInput, problemInput, solutionInput, objectiveInput): # To come up with title and intro, you need all values + Hook. | |
global Hook, TitleAndIntro #Declare as global | |
inputs = { | |
"Audience Input": audienceInput, | |
"Problem Input": problemInput, | |
"Solution Input": solutionInput, | |
"Objective Input": objectiveInput, | |
"Hook": Hook | |
} | |
empty_inputs = [name for name, value in inputs.items() if not value] | |
if empty_inputs: | |
return ( """Please make sure to fill in these empty inputs: \n""" + "\n".join(empty_inputs)) | |
else: | |
global client | |
user_message_content = ( | |
f"Target Audience: {audienceInput}\n" | |
f"Problem: {problemInput}\n" | |
f"Solution: {solutionInput}\n" | |
f"Video Objective: {objectiveInput}" | |
) | |
response = client.chat.completions.create( | |
model="gpt-4", | |
messages=[ | |
{ | |
"role": "system", | |
"content": "You are an expert script writer creating engaging YouTube tutorial scripts for beginners on how to use ChatGPT to solve the problems they encounter in the corporate environment. These scripts must be written in a simple conversational manner. Technical jargon and complex words must be avoided at all times. Do not use words like \"intricacy,\" \"robust,\" \"daunting,\" \"crucial,\" or \"compelling\" and other similar words. \n\nYour current task is to create a title and introduction based on the script brief that consist of a target audience, problem, solution, and video objective. \n\nThe title should be visualizing in an engaging way the video's objective. The title must be straight to the point, consist of a maximum of two phrases. It must not use abstract phrasing. \n\nThe intro should start by describing and explaining the key topic of the tutorial. For example, if the tutorial is about Brand Voice on social media, then it must start by explaining what brand voice is and why it's important. Make sure not to greet the specific target audience as this has already been done in a previous section. Technical jargon and complex words must be avoided at all times. Do not use words like \"intricacy,\" \"robust,\" \"daunting,\" \"crucial,\" or \"compelling\" and other similar words. \n\nAfter this description, it then must proceed with explaining what task is to be performed related to the key topic and why it's important to perform that task in a certain way. \n\nAnd finally, the intro wraps up with how the task can be performed with the help of ChatGPT. However, make sure not to say anything like \"In this tutorial, you will learn how to...\" because this is going to be covered in the next section. " | |
}, | |
{ | |
"role": "user", | |
"content": "Target Audience: members of the social media marketing team.\nProblem: Members of the marketing team come up with a text content to post on social media, but it doesn't always match the company's brand voice. \nSolution: With ChatGPT, they can use a prompt to check if their content matches their brand voice and provide suggestions. \nVideo Objective: The objective of the video is to teach the viewer how to use ChatGPT to review social media text content to check if it matches the brand voice. " | |
}, | |
{ | |
"role": "assistant", | |
"content": "Title: Ensuring Consistent Brand Voice on Social Media with ChatGPT\n\nWelcome to our guide on keeping your brand's voice consistent across social media, with a little help from ChatGPT.\n\nLet's start with the basics: your brand voice. Think of it as the personality of your company in words. It's how you talk to your audience, making your brand feel familiar and unique. Whether it's fun, serious, or something in between, your brand voice helps you connect with people in a meaningful way.\n\nBut here's the challenge: making sure this voice stays the same across all your social media posts can be tough. Ever been about to post something and stopped to wonder, \"Does this really sound like us?\" This is a common issue in social media marketing, where being consistent is important but not always easy.\n\nThat's where ChatGPT comes in. It's like your behind-the-scenes helper that can make sure every tweet, post, or update sounds exactly like your brand. With ChatGPT, you can make sure your brand's personality is always the star of the show on social media. Let's dive in." | |
}, | |
{ | |
"role": "user", | |
"content": "Target Audience: members of the sales team.\nProblem: Members of the sales team often spend a lot of time creating personalized emails for customers in different sales scenarios. \nSolution: With ChatGPT, they can use a prompt and create email templates for different sales scenarios. \nVideo Objective: The objective of the video is to teach the viewer how to use ChatGPT to create email templates for customers and various sales scenarios, so they no longer need to write emails from scratch every single time. " | |
}, | |
{ | |
"role": "assistant", | |
"content": "Title: Create Sales Email Templates with ChatGPT\n\nWelcome to this tutorial, where we address a common challenge faced by sales professionals: the time-consuming task of writing personalized emails for different sales scenarios. Personalizing emails is crucial because it helps build stronger connections with your customers. It shows that you see them as individuals with unique needs and preferences, which can significantly increase the effectiveness of your communication and boost your chances of making a sale.\n\nHowever, the catch is that crafting these personalized emails for various scenarios demands a considerable amount of time and effort. For example, you might need to create a warm introduction email for new leads, a detailed proposal email for interested prospects, a follow-up email after a meeting, or a thank-you email post-purchase. Each of these scenarios requires a different approach, tone, and content, making the task even more daunting.\n\nBut what if there was a way to streamline this process? That's where ChatGPT comes in. ChatGPT is an AI tool that can assist you in creating customized email templates for any sales situation. By leveraging intelligent prompts, ChatGPT helps generate relevant, personalized content, saving you time and effort. Stay with us as we dive into how ChatGPT can transform the way you handle sales emails, making your daily tasks smoother and more productive." | |
}, | |
{ | |
"role": "user", | |
"content": user_message_content | |
} | |
], | |
temperature=1, | |
max_tokens=1000, | |
top_p=1, | |
frequency_penalty=0, | |
presence_penalty=0 | |
) | |
TitleAndIntro = response.choices[0].message.content | |
return TitleAndIntro | |
#Generate Learning Objectives | |
#This function takes all four inputs from the text box and uses them to create learning objectives | |
#Before running, it makes sure that the hook and title and intro have already been generated | |
def GenerateLearningObjectives(audienceInput, problemInput, solutionInput, objectiveInput): | |
global Hook, TitleAndIntro, LearningObjectives #Declare as global | |
inputs = { | |
"Audience Input": audienceInput, | |
"Problem Input": problemInput, | |
"Solution Input": solutionInput, | |
"Objective Input": objectiveInput, | |
"Hook": Hook, | |
"TitleAndIntro": TitleAndIntro | |
} | |
empty_inputs = [name for name, value in inputs.items() if not value] | |
if empty_inputs: | |
return ( """Please make sure to fill in these empty inputs: \n""" + "\n".join(empty_inputs)) | |
else: | |
global client | |
user_message_content = ( | |
f"Target Audience: {audienceInput}\n" | |
f"Problem: {problemInput}\n" | |
f"Solution: {solutionInput}\n" | |
f"Video Objective: {objectiveInput}" | |
) | |
response = client.chat.completions.create( | |
model="gpt-4", | |
messages=[ | |
{ | |
"role": "system", | |
"content": "You are an expert script writer creating engaging YouTube tutorial scripts for beginners on how to use ChatGPT to solve the problems they encounter in the corporate environment. These scripts must be written in a simple conversational manner. Technical jargon and complex words must be avoided at all times. \n\nYour current task is to create the learning objectives the student needs to learn in order for the video to fulfill the video objectives located in the brief. Make sure the learning objectives CORRELATE to the specific video objectives. These learning objectives must be application-based and should involve the viewer performing a specific task. Make sure to keep the learning objectives brief. If only one learning objective is necessary, then only make 1 learning objective. You are only allowed to make A MAXIMUM OF 2 learning objectives, but only use 1 if needed. Learning objectives must always start with a Verb that specifies what the learner should do. Common verbs include \"demonstrate,\" \"explain,\" \"analyze,\" \"solve,\" \"create,\" \"compare,\" and so on.\n\nFinally, put all these learning objectives in a learning objective summary. This summary is usually written like \"By the end of this tutorial, you will be able to: 1. X, etc.\"" | |
}, | |
{ | |
"role": "user", | |
"content": "Topic: Using ChatGPT to make sure your post content on social media fits your company's brand voice.\nTarget Audience: members of the social media marketing team.\nProblem: Members of the marketing team come up with a text content to post on social media, but it doesn't always match the company's brand voice. \nSolution: With ChatGPT, they can use a prompt to check if their content matches their brand voice and provide suggestions. \n\nVideo Objective: The objective of the video is to:\n- teach the viewer how to use ChatGPT to review social media text content to check if it matches the brand voice. " | |
}, | |
{ | |
"role": "assistant", | |
"content": "By the end of this tutorial, you will be able to:\n1. Use ChatGPT review your social media draft post to test if it matches your brand voice" | |
}, | |
{ | |
"role": "user", | |
"content": "Topic: Using ChatGPT to create email templates for diverse sales scenarios.\nTarget Audience: members of the sales team.\nProblem: Members of the sales team often spend a lot of time creating personalized emails for customers in different sales scenarios. \nSolution: With ChatGPT, they can use a prompt and create email templates for different sales scenarios. \n\nVideo Objective: The objective of the video is to teach the viewer how to:\n- use ChatGPT to create email templates for customers and various sales scenarios, so they no longer need to write emails from scratch every single time. \n- use ChatGPT to customize email templates for different needs" | |
}, | |
{ | |
"role": "assistant", | |
"content": "By the end of this tutorial, you will be able to:\n\n1. Demonstrate how to utilize ChatGPT to create a variety of email templates to handle various sales scenarios.\n2. Apply ChatGPT to customize email templates for specific customer types or needs." | |
}, | |
{ | |
"role": "user", | |
"content": user_message_content | |
} | |
], | |
temperature=1, | |
max_tokens=300, | |
top_p=1, | |
frequency_penalty=0, | |
presence_penalty=0 | |
) | |
LearningObjectives = response.choices[0].message.content | |
return LearningObjectives | |
#Generate Prompts | |
#This function takes all four inputs and the learning objectives and uses them to create prompts | |
#Before running, it makes sure that the hook and title and intro have already been generated | |
def GeneratePrompts(audienceInput, problemInput, solutionInput, objectiveInput, learningObjectivesInput): | |
global Hook, TitleAndIntro, LearningObjectives, Prompts #Declare as global | |
inputs = { | |
"Audience Input": audienceInput, | |
"Problem Input": problemInput, | |
"Solution Input": solutionInput, | |
"Objective Input": objectiveInput, | |
"Hook": Hook, | |
"Title and Introduction": TitleAndIntro, | |
"Learning Objectives": LearningObjectives | |
} | |
empty_inputs = [name for name, value in inputs.items() if not value] | |
if empty_inputs: | |
return ( """Please make sure to fill in these empty inputs: \n""" + "\n".join(empty_inputs)) | |
else: | |
global client | |
user_message_content = ( | |
f"Target Audience: {audienceInput}\n" | |
f"Problem: {problemInput}\n" | |
f"Solution: {solutionInput}\n" | |
f"Video Objective: {objectiveInput}\n" | |
f"{learningObjectivesInput}\n" | |
) | |
response = client.chat.completions.create( | |
model="gpt-4", | |
messages=[ | |
{ | |
"role": "system", | |
"content": "You are an expert prompt engineer creating prompts for ChatGPT. These prompts follow the best practices for prompt engineering. These best practices include be specific and clear, provide context, define a role (expert marketer, master HR recruiter), specify a desired format, be concise, and use automatic prompts that end with \"Ask me as many questions as you need until you have enough information to provide me with the desired output.\"\n\nYour current task is to create the best prompts for each learning objective found in the learning objective summary provided. For more context, you can review the video objective found in the brief. " | |
}, | |
{ | |
"role": "user", | |
"content": "Topic: Using ChatGPT to create email templates for diverse sales scenarios.\nTarget Audience: members of the sales team.\nProblem: Members of the sales team often spend a lot of time creating personalized emails for customers in different sales scenarios. \nSolution: With ChatGPT, they can use a prompt and create email templates for different sales scenarios. \nVideo Objective: The objective of the video is to teach the viewer how to use ChatGPT to create email templates for customers and various sales scenarios, so they no longer need to write emails from scratch every single time.\n\nBy the end of this tutorial, you will be able to:\n1. Use ChatGPT to identify different sales scenarios;\n2. Generate personalized email templates for these scenarios using ChatGPT. " | |
}, | |
{ | |
"role": "assistant", | |
"content": "Prompt for Learning Objective 1: Identifying Different Sales Scenarios with ChatGPT\n\nYou are a sales expert advisor. Consider the [Your Company]'s popular product/service range. Based on the buyer persona [provide some characteristics of your typical customer], could you suggest some different sales scenarios that our sales team should be prepared for? Ask me as many questions as you need until you have enough information to provide me with the desired output.\n\nPrompt for Learning Objective 2: Generating Personalized Email Templates for Different Sales Scenarios Using ChatGPT\n\nGiven the sales scenario of [provide a specific sales scenario - e.g., following up with a prospect after a meeting, answering a query, etc.], could you help me create a personalized email template to address this? Remember, our brand voice is [describe brand voice - e.g., professional, friendly, informative, casual, etc.]. Ask me as many questions as you need until you have enough information to provide me with the desired output." | |
}, | |
{ | |
"role": "user", | |
"content": user_message_content | |
} | |
], | |
temperature=1, | |
max_tokens=500, | |
top_p=1, | |
frequency_penalty=0, | |
presence_penalty=0 | |
) | |
Prompts = response.choices[0].message.content | |
return Prompts | |
#Generate Tutorial Sections | |
#This function takes all four inputs and the learning objectives and uses them to create prompts | |
#Before running, it makes sure that the hook and title and intro have already been generated | |
def GenerateTutorialSections(objectiveInput, learningObjectiveBox, promptBox): | |
global TutorialSections #Declare as global | |
inputs = { | |
"Video Objective": objectiveInput, | |
"Learning Objectives": learningObjectiveBox, | |
"Prompts": promptBox | |
} | |
empty_inputs = [name for name, value in inputs.items() if not value] | |
if empty_inputs: | |
return ( """Please make sure to fill in these empty inputs: \n""" + "\n".join(empty_inputs)) | |
else: | |
global client | |
user_message_content = ( | |
f"Video Objective: {objectiveInput}\n" | |
f"{learningObjectiveBox}\n" | |
f"{promptBox}\n" | |
) | |
response = client.chat.completions.create( | |
model="gpt-4", | |
messages=[ | |
{ | |
"role": "system", | |
"content": "You are an expert script writer skilled in creating engaging YouTube tutorial scripts for beginners on how to use ChatGPT to solve the problems they encounter in the corporate environment. These scripts must be written in a simple conversational manner, without complex words and technical jargon.\n\nYour current task is to create tutorial sections for each learning objective found in the learning objective summary provided. These learning objectives have corresponding prompts, and you need to incorporate these prompts into the tutorial sections. For more context, you can review the video objective found in the brief. \n\nUsing these three inputs, you need to create tutorial sections that teach the student in a straightforward manner how to use these prompts. Do not greet the viewer as this has already been done in a previous section. Simply jump right into the topic.\n\nWhen writing these sections, in a conversational manner, first describe the task. Then explain why it's useful to utilize ChatGPT for that task. Finally, teach the viewer how to use the prompt. Make sure not to change the prompt that is provided to you. \n\nIf the prompt is an automatic prompt, you will have to tell the viewer to answer the questions asked by ChatGPT before they can get the final result. If the prompt is the second prompt used, make sure to inform the viewer to add that prompt in the same chat. \n\nLastly, once all learning objectives have been covered, make sure to wrap it up with a conclusion. " | |
}, | |
{ | |
"role": "user", | |
"content": "Video Objective: The objective of the video is to teach the viewer how to use ChatGPT to create email templates for customers and various sales scenarios, so they no longer need to write emails from scratch every single time.\n\nBy the end of this tutorial, you will be able to:\n1. Use ChatGPT to identify different sales scenarios;\n2. Generate personalized email templates for these scenarios using ChatGPT. \n\nPrompt for Learning Objective 1: Identifying Different Sales Scenarios with ChatGPT\n\nYou are a sales expert advisor. Consider the [Your Company]'s popular product/service range. Based on the buyer persona [provide some characteristics of your typical customer], could you suggest some different sales scenarios that our sales team should be prepared for? Ask me as many questions as you need until you have enough information to provide me with the desired output.\n\nPrompt for Learning Objective 2: Generating Personalized Email Templates for Different Sales Scenarios Using ChatGPT\n\nGiven the sales scenario of [provide a specific sales scenario - e.g., following up with a prospect after a meeting, answering a query, etc.], could you help me create a personalized email template to address this? Remember, our brand voice is [describe brand voice - e.g., professional, friendly, informative, casual, etc.]. Ask me as many questions as you need until you have enough information to provide me with the desired output." | |
}, | |
{ | |
"role": "assistant", | |
"content": "Section 1: \nIdentifying Different Sales Scenarios with ChatGPT\n\nLet's start with our first task - using ChatGPT to identify various sales scenarios. As we know, dealing with customers isn't a one-size-fits-all situation. That's why having well-defined sales scenarios can guide your salesforce in handling a wide range of potential situations more efficiently.\n\nHere's where ChatGPT becomes valuable. It can digest the specifics of your company and its range of services or products, as well as the characteristics of your typical customer, to generate diverse sales scenarios you'll likely encounter. \n\nNow, let's take a look at how we can use the prompt: \n\n\"You are a sales expert advisor. Consider the [Your Company]'s popular product/service range. Based on the buyer persona [provide some characteristics of your typical customer], could you suggest some different sales scenarios that our sales team should be prepared for? Ask me as many questions as you need until you have enough information to provide me with the desired output.\"\n\nStart by replacing '[Your Company]' with the name of your actual company. Following this, for the buyer persona, plug in some key characteristics of your typical customer. Then, press Enter. \n\nWhen you input this prompt into ChatGPT, it will ask you a few questions to get the information it needs to perform the task correctly. Answer the questions, and then press Enter. \n\nAnd finally, GPT will give you a result. Go ahead, repeat and refine this process as many times as you want until you have enough sales scenarios that fit your customers!\n\nSection 2: \nGenerating Personalized Email Templates for Different Sales Scenarios Using ChatGPT\n\nAwesome! Now that we've identified different sales scenarios, let's move on to how you can utilize ChatGPT to create personalized email templates to fit these scenarios. Why personalize? Because each customer and scenario is unique, and using generic templates can create the impression of not fully understanding or respecting the customer's situation. \n\nChatGPT can come really handy here. It can craft sales emails for specific scenarios that align perfectly with your brand voice and focus on your target customer's needs.\n\nIn the same chat, type into ChatGPT: \"Given the sales scenario of [provide a specific sales scenario - e.g., following up with a prospect after a meeting, answering a query, etc.], could you help me create a personalized email template to address this? Remember, our brand voice is [describe brand voice - e.g., professional, friendly, informative, casual, etc.]. Ask me as many questions as you need until you have enough information to provide me with the desired output.\"\n\nFor this prompt, replace '[provide a specific sales scenario]' with one of the sales scenarios that you've previously identified. Then, describe your brand voice where it says '[describe brand voice]'. Then, press Enter. \n\nOnce again, ChatGPT will come up with a few questions that you'll have to answer. Press Enter, and it will give you what you've asked for. \n\nRemember, you can keep refining your questions to get the output just as you want. \n\nConclusion: \nAnd there you have it! In this tutorial, you learned an efficient and straightforward way of identifying sales scenarios and generating personalized email templates using ChatGPT. As you continue to apply these skills, remember that the landscape of sales and customer interactions is ever-evolving. Stay curious, keep experimenting with ChatGPT prompts, and refine your approaches to stay ahead." | |
}, | |
{ | |
"role": "user", | |
"content": user_message_content | |
} | |
], | |
temperature=1, | |
max_tokens=1500, | |
top_p=1, | |
frequency_penalty=0, | |
presence_penalty=0 | |
) | |
TutorialSections = response.choices[0].message.content | |
return TutorialSections | |
#Generate Generate Full Script | |
#This function takes all contents of the text boxes and combines them into something that can be copy-pasted | |
#Before running, it makes sure that the hook and title and intro have already been generated | |
def GenerateFullScript(hookBox, titleAndIntroBox, learningObjectivesBox, tutorialSectionsBox): | |
global FinalScript #Declare as global | |
inputs = { | |
"Hook": hookBox, | |
"Title and Introduction": titleAndIntroBox, | |
"Learning Objectives": learningObjectivesBox, | |
"Tutorial Sections": tutorialSectionsBox | |
} | |
empty_inputs = [name for name, value in inputs.items() if not value] | |
if empty_inputs: | |
return ( """Please make sure to fill in these empty inputs: \n""" + "\n".join(empty_inputs)) | |
else: | |
FinalScript = hookBox + "\n\n" + titleAndIntroBox + "\n\n" + learningObjectivesBox + "\n\n" + tutorialSectionsBox | |
return FinalScript | |
def ClearAndReset(allElems): | |
for i in allElems: | |
i.clear() | |
return None | |
def ReviewAnswers(audienceInput, problemInput, solutionInput, objectiveInput): | |
inputs = { | |
"Audience Input": audienceInput, | |
"Problem Input": problemInput, | |
"Solution Input": solutionInput, | |
"Objective Input": objectiveInput | |
} | |
empty_inputs = [name for name, value in inputs.items() if not value] | |
if empty_inputs: | |
return ( """Please make sure to fill in these empty inputs: \n""" + "\n".join(empty_inputs)) | |
else: | |
global client | |
user_message_content = ( | |
f"Target Audience: {audienceInput}\n" | |
f"Problem: {problemInput}\n" | |
f"Solution: {solutionInput}\n" | |
f"Video Objective: {objectiveInput}" | |
) | |
response = client.chat.completions.create( | |
model="gpt-4", | |
messages=[ | |
{ | |
"role": "system", | |
"content": "You are an expert script writer creating engaging YouTube tutorial scripts for beginners on how to use ChatGPT to solve the problems they encounter in the corporate environment. \n\nYour current task is to review the inputs that people use when they are writing a prompt into ChatGPT. \n\nThe types of input are: \n- Target Audience\n- Problem\n- Solution\n- Video Objective\n\nThe Target Audience refers to the specific audience the writer wants to target. This can be \"HR Recruiter,\" \"Customer Service Personnel\" or something specific. \n\nThe Problem refers to the type of problem the audience faces. The problem must be written in a straightforward manner and be articulated in a clear way. It needs to be specific, not vague. \n\nThe Solution refers to how specifically ChatGPT can help the audience solve that problem. \n\nFinally, the Video Objective refers to the purpose of the video and the steps that need to be achieved in order for the audience to learn what they need to learn. Make sure each step is listed in bullet format. \n\nWhen reviewing inputs, provide a rating for each input and give the writer a rating of 1 (unclear) to 5 (perfectly clear). Then, if their input is unclear, give them feedback without giving them the specific solution. " | |
}, | |
{ | |
"role": "user", | |
"content": "Target Audience: members of the social media marketing team.\nProblem: Members of the marketing team come up with a text content to post on social media, but it doesn't always match the company's brand voice. \nSolution: With ChatGPT, they can use a prompt to check if their content matches their brand voice and provide suggestions. \nVideo Objective: The objective of the video is to teach the viewer how to:\n- use ChatGPT to review social media text content to check if it matches the brand voice. " | |
}, | |
{ | |
"role": "assistant", | |
"content": "Target Audience: 5/5 - Your target audience is perfectly clear. \n\nProblem: 5/5 - The problem of maintaining brand voice in social media posts is a common challenge, and you have articulated it well. \n\nSolution: 4/5 - Your solution is correct, as ChatGPT can indeed help with this. Yet, you could have been more specific about how the tool will be used, such as providing an example prompt. \n\nVideo Objective: 4/5 - Your objective is clear, although a more detailed list of steps for using ChatGPT would be beneficial. Remember to break down the process into bitesize points that viewers can follow.\n\nOverall a good effort, a little more detail can, however, improve it and offer better clarity to your viewers." | |
}, | |
{ | |
"role": "user", | |
"content": user_message_content | |
} | |
], | |
temperature=1, | |
max_tokens=256, | |
top_p=1, | |
frequency_penalty=0, | |
presence_penalty=0 | |
) | |
review = response.choices[0].message.content | |
return review | |
# Main | |
with gr.Blocks(theme=gr.themes.Soft()) as main: | |
with gr.Column(): | |
gr.Markdown(introStatement) | |
# Main Inputs | |
gr.Markdown(step1Statement) | |
audienceBox = gr.Textbox(label="Who is your audience?") | |
problemBox = gr.Textbox(label="What problem does your audience have?") | |
solutionBox = gr.Textbox(label="How is ChatGPT able to solve this problem?") | |
objectiveBox = gr.Textbox(label="What is this video's objective?") | |
# Review Answers | |
reviewAnswersBtn = gr.Button("Review Answers") | |
reviewAnswersBox = gr.Textbox(label="Review Results", interactive=False) | |
# Start Button | |
startBtn = gr.Button("Let's start!") | |
# Forms | |
gr.Markdown(step2Statement) | |
with gr.Column(): | |
step2aOutput = gr.Textbox(label="Step 2a. Hook") | |
with gr.Row(): | |
step2aReject = gr.Button("Regenerate Current Step") | |
step2aApprove = gr.Button("Generate Next Step") | |
with gr.Column(): | |
step2bOutput = gr.Textbox(label="Step 2b. Title and Introduction") | |
with gr.Row(): | |
step2bReject = gr.Button("Regenerate Current Step") | |
step2bApprove = gr.Button("Generate Next Step") | |
with gr.Column(): | |
step2cOutput = gr.Textbox(label="Step 2c. Learning Objectives") | |
with gr.Row(): | |
step2cReject = gr.Button("Regenerate Current Step") | |
step2cApprove = gr.Button("Generate Next Step") | |
with gr.Column(): | |
step2dOutput = gr.Textbox(label="Step 2d. Prompts") | |
with gr.Row(): | |
step2dReject = gr.Button("Regenerate Current Step") | |
step2dApprove = gr.Button("Generate Next Step") | |
with gr.Column(): | |
step2eOutput = gr.Textbox(label="Step 2e. Tutorial Section and Conclusion") | |
with gr.Row(): | |
step2eReject = gr.Button("Regenerate Current Step") | |
step2eApprove = gr.Button("Generate full script") | |
# Conclusion | |
gr.Markdown(step3Statement) | |
output = gr.Textbox(label="Output Box") | |
# restart = gr.Button("Want to make another script? Click me!") | |
# Set up click events: startBtn | |
startBtn.click(fn = GenerateHook, inputs=[audienceBox, problemBox, solutionBox, objectiveBox, reviewAnswersBox], outputs=step2aOutput) | |
# Set up click events: Review | |
reviewAnswersBtn.click(fn = ReviewAnswers, inputs=[audienceBox, problemBox, solutionBox, objectiveBox], outputs=reviewAnswersBox) | |
# Set up click events: Hook | |
step2aApprove.click(fn = GenerateTitleAndIntro, inputs=[audienceBox, problemBox, solutionBox, objectiveBox], outputs=step2bOutput) | |
step2aReject.click(fn = GenerateHook, inputs=[audienceBox, problemBox, solutionBox, objectiveBox, reviewAnswersBox], outputs=step2aOutput) | |
# Set up click events: Title and Intro | |
step2bApprove.click(fn = GenerateLearningObjectives, inputs=[audienceBox, problemBox, solutionBox, objectiveBox], outputs=step2cOutput) | |
step2bReject.click(fn = GenerateTitleAndIntro, inputs=[audienceBox, problemBox, solutionBox, objectiveBox], outputs=step2bOutput) | |
# Set up click events: Learning Objecitves | |
step2bApprove.click(fn = GenerateLearningObjectives, inputs=[audienceBox, problemBox, solutionBox, objectiveBox], outputs=step2cOutput) | |
step2bReject.click(fn = GenerateTitleAndIntro, inputs=[audienceBox, problemBox, solutionBox, objectiveBox], outputs=step2bOutput) | |
# Set up click events: Prompts | |
step2cApprove.click(fn = GeneratePrompts, inputs=[audienceBox, problemBox, solutionBox, objectiveBox, step2cOutput], outputs=step2dOutput) | |
step2cReject.click(fn = GenerateLearningObjectives, inputs=[audienceBox, problemBox, solutionBox, objectiveBox], outputs=step2cOutput) | |
# Set up click events: Tutorial Sections | |
step2dApprove.click(fn = GenerateTutorialSections, inputs=[objectiveBox, step2cOutput, step2dOutput], outputs=step2eOutput) | |
step2dReject.click(fn = GeneratePrompts, inputs=[audienceBox, problemBox, solutionBox, objectiveBox, step2cOutput], outputs=step2dOutput) | |
# Set up click events: Final Script | |
step2eApprove.click(fn = GenerateFullScript, inputs=[step2aOutput, step2bOutput, step2cOutput, step2eOutput], outputs=output) | |
step2eReject.click(fn = GenerateTutorialSections, inputs=[objectiveBox, step2cOutput, step2dOutput], outputs=step2eOutput) | |
# Set up click events: reset | |
allElems = [ | |
audienceBox, | |
problemBox, | |
solutionBox, | |
objectiveBox, | |
step2aOutput, | |
step2bOutput, | |
step2cOutput, | |
step2dOutput, | |
step2eOutput | |
] | |
#restart.click(fn = ClearAndReset, inputs=[allElems]) | |
# Launch | |
main.launch() | |