Spaces:
Runtime error
Runtime error
File size: 3,230 Bytes
bf70abc 0a480c8 c1fbddd a452991 a3215c8 bf70abc 5ad4863 f23c1ac a452991 c3fad62 e2c5f07 b724b7a 5ad4863 c3fad62 e2c5f07 5ad4863 b724b7a 5ad4863 e2c5f07 5ad4863 552b52c 5ad4863 e2c5f07 5ad4863 b724b7a a452991 e2c5f07 3cd9850 a452991 a3215c8 a452991 e2c5f07 a452991 a3215c8 e2c5f07 a452991 e2c5f07 a3215c8 e2c5f07 5ad4863 e2c5f07 a3215c8 a452991 5ad4863 |
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("Valentine's Day Video Scripter for Small Businesses")
# 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 Valentine's Day themes or ideas you have in mind for the video?")
if st.button('Generate Video Script'):
# Detailed prompt for AI focusing on Valentine's Day
ai_instructions = """
Create a playful and engaging Valentine's Day themed video script for the specified platform, focusing on content that resonates with the target audience for Valentine's promotions. The script should creatively promote the business while incorporating Valentine's Day elements.
Steps:
1. Review the business description, target audience, and initial video ideas, then brainstorm 20 potential video concepts with compelling Valentine's Day themed hooks.
2. Select the best concept that is playful and aligns with Valentine's Day. Develop a script under 200 words, suitable for short-form video formats. Consider 10 varied
ideas for a compelling hook, the first sentence or two of the video. This should grab the viewer's attention and spark their curiosity to watch the rest of the video.
3. Include a strong and relevant call to action for Valentine's Day, encouraging viewers to engage with the business.
4. Provide the script first, followed by additional filming and editing tips suitable for the chosen platform, emphasizing Valentine's Day aesthetics.
The script should be ready to use in a teleprompter, free of shot directions or speaker references, and tailored to Valentine's Day promotional activities.
"""
# 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 Valentine's Day 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, especially for Valentine's Day.")
|