dlennon commited on
Commit
33262d3
·
verified ·
1 Parent(s): 32341e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -11
app.py CHANGED
@@ -6,23 +6,30 @@ import os
6
  openai.api_key = os.getenv("OPENAI_API_KEY")
7
 
8
  def generate_video_script(title, formality_level, emotional_tone, engagement_level):
9
- # Construct the prompt with the provided details
10
  prompt = (
11
  f"[Use this video framework below]\n"
12
  f"First we need to have a strong hook.\n"
13
  f"A short intro that stops people from scrolling and holds their attention\n"
14
- f"Example: \"{title}\"\n"
15
  f"Now we add in “The Setup\"\n"
16
  f"* This is used to Setup the scene and provide context to the Viewer\n"
17
- f"* Example: \"I've been creating videos recently and I guess something finally clicked\"\n"
 
18
  f"ACT 2: \"The Conflict\"\n"
19
  f"* Introduce a point of conflict or problem that requires a solution\n"
20
- f"* Example: \"Some of you have been asking about scripting and storytelling and there's a lot to talk about, but I gotchu\"\n"
 
 
21
  f"ACT 3: \"The Resolution\"\n"
22
  f"* Addressing the conflict we introduced and resolving it\n"
23
- f"* Example: \"Here's how I tell my stories. All you need are these 3: ACT I, ACT II, and ACT III.\"\n"
 
 
24
  f"Call-To-Action\n"
25
- f"* Example: \"And if you wanna know how that looks like, then watch this video back and follow for more.\"\n"
 
 
26
  f"Follow these instructions above in creating a Viral Video script for me.\n"
27
  f"Topic: {title}\n"
28
  f"Tone: {emotional_tone}\n"
@@ -31,12 +38,12 @@ def generate_video_script(title, formality_level, emotional_tone, engagement_lev
31
  )
32
 
33
  try:
34
- response = openai.ChatCompletion.create(
35
- engine="gpt-3.5-turbo",
36
  prompt=prompt,
37
- max_tokens=300,
38
- temperature=0.7, # Adjust for creativity
39
- stop="\n"
40
  )
41
  script = response.choices[0].text.strip()
42
  return script
 
6
  openai.api_key = os.getenv("OPENAI_API_KEY")
7
 
8
  def generate_video_script(title, formality_level, emotional_tone, engagement_level):
9
+ # Construct the original detailed prompt as provided
10
  prompt = (
11
  f"[Use this video framework below]\n"
12
  f"First we need to have a strong hook.\n"
13
  f"A short intro that stops people from scrolling and holds their attention\n"
14
+ f"Example. \"{title}\"\n"
15
  f"Now we add in “The Setup\"\n"
16
  f"* This is used to Setup the scene and provide context to the Viewer\n"
17
+ f"* ex. \"I've been creating videos recently and I guess something finally clicked\"\n"
18
+ f"* This lets the viewer know that she’s been uploading more videos recently, and that could have led to an increase in views and followers.\n"
19
  f"ACT 2: \"The Conflict\"\n"
20
  f"* Introduce a point of conflict or problem that requires a solution\n"
21
+ f"* ex. \"Some of you have been asking about scripting and storytelling and there's a lot to talk about, but I gotchu\"\n"
22
+ f"* Setting up the foundation to lead to the topic of the video and posing the concern that 'there's a lot to talk about'\n"
23
+ f"* Which opens the question of how we're going to tackle the topic in a limited amount of time\n"
24
  f"ACT 3: \"The Resolution\"\n"
25
  f"* Addressing the conflict we introduced and resolving it\n"
26
+ f"* ex. \"Here's how I tell my stories. All you need are these 3: ACT I, ACT II, and ACT III.\"\n"
27
+ f"* She proceeds to explain how we structure and tell our stories, which answers and resolves the initial conflict\n"
28
+ f"A call to action or loop.\n"
29
  f"Call-To-Action\n"
30
+ f"* After giving valuable information to your viewer, you have to be able to lead them somewhere or encourage them to engage\n"
31
+ f"* ex. \"And if you wanna know how that looks like, then watch this video back and follow for more.\"\n"
32
+ f"* This encourages the audience to rewatch the video to see the video is an actual example of what they just learned and it encourages them to follow and share the content if they found it valuable!\n"
33
  f"Follow these instructions above in creating a Viral Video script for me.\n"
34
  f"Topic: {title}\n"
35
  f"Tone: {emotional_tone}\n"
 
38
  )
39
 
40
  try:
41
+ response = openai.Completion.create(
42
+ model="gpt-3.5-turbo",
43
  prompt=prompt,
44
+ max_tokens=1024,
45
+ temperature=0.7,
46
+ stop=["\n", "Follow these instructions above in creating a Viral Video script for me."]
47
  )
48
  script = response.choices[0].text.strip()
49
  return script