File size: 2,645 Bytes
bf70abc
0a480c8
c1fbddd
a452991
a3215c8
bf70abc
e2c5f07
f23c1ac
a452991
 
 
 
c3fad62
e2c5f07
 
 
b724b7a
e2c5f07
c3fad62
e2c5f07
b724b7a
 
e2c5f07
 
 
 
 
 
 
 
 
b724b7a
 
a452991
e2c5f07
3cd9850
a452991
a3215c8
a452991
 
 
e2c5f07
a452991
 
a3215c8
e2c5f07
a452991
e2c5f07
a3215c8
e2c5f07
 
 
a3215c8
a452991
e2c5f07
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import streamlit as st
import openai

# Access the OpenAI API key from Hugging Face Spaces secrets
openai.api_key = st.secrets["OPENAI_API_KEY"]

st.title("Small Business Video Scripter")

# User inputs
st.subheader("About Your Business")
business_description = st.text_area("Describe Your Business", placeholder="What does your business do? What are its unique features?")
target_audience = st.text_area("Target Audience", placeholder="Describe the kinds of people you want to attract (e.g., demographics, interests)")

st.subheader("Video Type and Platform")
video_type = st.text_input("Video Type/Platform", placeholder="E.g., TikTok, Instagram Reels, YouTube")

st.subheader("Initial Video Ideas")
initial_ideas = st.text_area("Initial Video Ideas", placeholder="Any initial ideas or themes you have in mind for the video?")

if st.button('Generate Video Script'):
    # Detailed prompt for AI including the steps
    ai_instructions = """
    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. 

    Steps:
    1. Review the business description, target audience, and initial video ideas to brainstorm 20 potential video concepts with compelling hooks. 
    2. Select the best concept and develop a script. The script should be under 200 words, aligning with effective short-form video formats.
    3. Include a strong call to action relevant to the small business.
    4. Provide the script first, followed by additional filming and editing tips suitable for the chosen platform.
    
    The script should be teleprompter-ready, free of shot directions or speaker references.
    """

    # Construct the prompt for the AI
    prompt_text = f"{ai_instructions}\nBusiness description: {business_description}. Target audience: {target_audience}. Video type/platform: {video_type}. Initial video ideas: {initial_ideas}."

    # Call the OpenAI API for text generation
    try:
        response_text = openai.ChatCompletion.create(
            model="gpt-4",
            messages=[
                {"role": "system", "content": ai_instructions},
                {"role": "user", "content": prompt_text}
            ]
        )
        script = response_text.choices[0].message['content']
    except Exception as e:
        script = f"Error in generating video script: {e}"

    # Display the video script
    st.markdown("### Your Video Script")
    st.write(script)

# Disclaimer
st.write("Disclaimer: This script is AI-generated. Please review and customize it to fit your specific business needs and video platform.")