bizvideoschool commited on
Commit
e2c5f07
1 Parent(s): b6958a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -32
app.py CHANGED
@@ -4,61 +4,52 @@ import openai
4
  # Access the OpenAI API key from Hugging Face Spaces secrets
5
  openai.api_key = st.secrets["OPENAI_API_KEY"]
6
 
7
- st.title("Short-Form Video Planner")
8
 
9
  # User inputs
10
  st.subheader("About Your Business")
11
  business_description = st.text_area("Describe Your Business", placeholder="What does your business do? What are its unique features?")
12
  target_audience = st.text_area("Target Audience", placeholder="Describe the kinds of people you want to attract (e.g., demographics, interests)")
13
 
 
 
 
14
  st.subheader("Initial Video Ideas")
15
- initial_ideas = st.text_area("Initial Video Ideas", placeholder="Any initial ideas or themes you have in mind for the TikTok video?")
16
 
17
- if st.button('Generate Video Plan'):
18
  # Detailed prompt for AI including the steps
19
  ai_instructions = """
20
- You are an AI consultant skilled in crafting short-form (think TikTok or Reels) video scripts for small business owners working from their home offices. Your expertise lies in creating
21
- engaging short-form video content that is perfect for the TikTok platform. Generate a single, creative video idea that can be filmed in a home office
22
- setting, ensuring it is under 60 seconds and suitable for TikTok or Reels. Follow these steps as you create the script. Complete the steps first, then reply to the user.
23
-
24
- 1. Consider the idea and details provided by the user. Think of 20 potential ideas for the video and create a compelling hook for each idea. The hook is the first sentence
25
- or two of the video. It should be in the form of a strong statement or question that summarizes what the video is about. You can recommend easy to find household items to
26
- use a prop in the hook as well.
27
- 2. Choose the best idea and hook. Then write the body of the video. Review the most effective formats for short-form videos and structure the script based on those formats.
28
- Keep the script under 200 words while also delivering a valuable experience for the viewer. The script should inform, educate, or entertain the viewer.
29
- Include a strong call to action that invites the viewer to contact the small business owner to take the next step. If the user requests a specific call to action use that instead.
30
- 3. Once you have determined a hook and script. Reply to the user with the full script first, followed by any additional tips or sugggestions for the video. The script
31
- must be only the words the user will read. It should be formatted without any shot instructions or references to who is speaking. The user should be able to copy the script
32
- and paste it into a teleprmopter to read without any editing. Below the script you can then provide any additional notes.
33
-
34
- Complete these steps first. Then only reply to the user with the script and suggestions. Do not reply with any of your internal decision making.
35
-
36
  """
37
 
38
  # Construct the prompt for the AI
39
- prompt_text = f"""
40
- {ai_instructions}
41
- Business description: {business_description}.
42
- Target audience: {target_audience}.
43
- Initial video ideas: {initial_ideas}.
44
- """
45
 
46
  # Call the OpenAI API for text generation
47
  try:
48
  response_text = openai.ChatCompletion.create(
49
  model="gpt-4",
50
  messages=[
51
- {"role": "system", "content": "You are an AI assistant specializing in social media content planning."},
52
  {"role": "user", "content": prompt_text}
53
  ]
54
  )
55
- video_plan = response_text.choices[0].message['content']
56
  except Exception as e:
57
- video_plan = f"Error in generating video plan: {e}"
58
 
59
- # Display the video plan
60
- st.markdown("### Your TikTok Video Plan")
61
- st.write(video_plan)
62
 
63
  # Disclaimer
64
- st.write("Disclaimer: This tool provides AI-generated suggestions. Final content should be tailored to your specific business needs.")
 
4
  # Access the OpenAI API key from Hugging Face Spaces secrets
5
  openai.api_key = st.secrets["OPENAI_API_KEY"]
6
 
7
+ st.title("Small Business Video Scripter")
8
 
9
  # User inputs
10
  st.subheader("About Your Business")
11
  business_description = st.text_area("Describe Your Business", placeholder="What does your business do? What are its unique features?")
12
  target_audience = st.text_area("Target Audience", placeholder="Describe the kinds of people you want to attract (e.g., demographics, interests)")
13
 
14
+ st.subheader("Video Type and Platform")
15
+ video_type = st.text_input("Video Type/Platform", placeholder="E.g., TikTok, Instagram Reels, YouTube")
16
+
17
  st.subheader("Initial Video Ideas")
18
+ initial_ideas = st.text_area("Initial Video Ideas", placeholder="Any initial ideas or themes you have in mind for the video?")
19
 
20
+ if st.button('Generate Video Script'):
21
  # Detailed prompt for AI including the steps
22
  ai_instructions = """
23
+ As an AI consultant, create a video script suitable for the specified platform and format, focusing on engaging content that resonates with the business's target audience.
24
+
25
+ Steps:
26
+ 1. Review the business description, target audience, and initial video ideas to brainstorm 20 potential video concepts with compelling hooks.
27
+ 2. Select the best concept and develop a script. The script should be under 200 words, aligning with effective short-form video formats.
28
+ 3. Include a strong call to action relevant to the small business.
29
+ 4. Provide the script first, followed by additional filming and editing tips suitable for the chosen platform.
30
+
31
+ The script should be teleprompter-ready, free of shot directions or speaker references.
 
 
 
 
 
 
 
32
  """
33
 
34
  # Construct the prompt for the AI
35
+ prompt_text = f"{ai_instructions}\nBusiness description: {business_description}. Target audience: {target_audience}. Video type/platform: {video_type}. Initial video ideas: {initial_ideas}."
 
 
 
 
 
36
 
37
  # Call the OpenAI API for text generation
38
  try:
39
  response_text = openai.ChatCompletion.create(
40
  model="gpt-4",
41
  messages=[
42
+ {"role": "system", "content": ai_instructions},
43
  {"role": "user", "content": prompt_text}
44
  ]
45
  )
46
+ script = response_text.choices[0].message['content']
47
  except Exception as e:
48
+ script = f"Error in generating video script: {e}"
49
 
50
+ # Display the video script
51
+ st.markdown("### Your Video Script")
52
+ st.write(script)
53
 
54
  # Disclaimer
55
+ st.write("Disclaimer: This script is AI-generated. Please review and customize it to fit your specific business needs and video platform.")