bizvideoschool commited on
Commit
0f64b20
1 Parent(s): 709dce9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -8
app.py CHANGED
@@ -1,5 +1,7 @@
1
  import streamlit as st
2
  import openai
 
 
3
 
4
  # Access the OpenAI API key from Hugging Face Spaces secrets
5
  openai.api_key = st.secrets["OPENAI_API_KEY"]
@@ -14,7 +16,7 @@ target_audience = st.text_area("Describe Your Target Audience", placeholder="e.g
14
  st.subheader("Current Marketing Efforts")
15
  current_marketing = st.text_area("Current Marketing Strategies", placeholder="Describe your ongoing marketing activities.")
16
 
17
- # Test data button
18
  if st.button('Load Test Data'):
19
  st.session_state['business_type'] = "Real Estate Agency"
20
  st.session_state['target_audience'] = "Families and individuals looking to buy homes in suburban areas, focusing on first-time homebuyers and those seeking to upgrade to larger properties."
@@ -28,13 +30,10 @@ current_marketing = st.text_area("Current Marketing Strategies", value=st.sessio
28
  if st.button('Generate My Video Marketing Plan'):
29
  # Construct the prompt for text generation
30
  prompt_text = (
31
- f"Create a detailed 2024 video marketing plan for a real estate agency, {business_type}, targeting {target_audience}. "
32
- f"Begin with 3-5 content pillars that will guide the video themes. "
33
- f"Then, provide up to four distinct and creative video ideas for each month, tailored to these content pillars. Your response must include ideas for all 12 months of the year. Do not simply summarize a recommendation for some of the remaining months. "
34
- f"Include 10 specific distribution strategies to maximize video views, "
35
- f"focusing on reaching the ideal audience, based on current marketing efforts: {current_marketing}."
36
- )
37
-
38
 
39
  # Call the OpenAI API for text generation
40
  try:
@@ -52,3 +51,15 @@ if st.button('Generate My Video Marketing Plan'):
52
  # Display the marketing plan
53
  st.markdown("### Your Customized Video Marketing Plan")
54
  st.write(marketing_plan)
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import openai
3
+ import pdfkit
4
+ import os
5
 
6
  # Access the OpenAI API key from Hugging Face Spaces secrets
7
  openai.api_key = st.secrets["OPENAI_API_KEY"]
 
16
  st.subheader("Current Marketing Efforts")
17
  current_marketing = st.text_area("Current Marketing Strategies", placeholder="Describe your ongoing marketing activities.")
18
 
19
+ # Test data button for ease of testing
20
  if st.button('Load Test Data'):
21
  st.session_state['business_type'] = "Real Estate Agency"
22
  st.session_state['target_audience'] = "Families and individuals looking to buy homes in suburban areas, focusing on first-time homebuyers and those seeking to upgrade to larger properties."
 
30
  if st.button('Generate My Video Marketing Plan'):
31
  # Construct the prompt for text generation
32
  prompt_text = (
33
+ f"Generate a 2024 video marketing plan for a {business_type} targeting an audience characterized as: {target_audience}. "
34
+ f"Include up to four video ideas for each month and 10 specific distribution strategies to maximize video views, "
35
+ f"based on current marketing efforts: {current_marketing}."
36
+ )
 
 
 
37
 
38
  # Call the OpenAI API for text generation
39
  try:
 
51
  # Display the marketing plan
52
  st.markdown("### Your Customized Video Marketing Plan")
53
  st.write(marketing_plan)
54
+
55
+ # Convert the marketing plan to a PDF and provide a download button
56
+ if marketing_plan:
57
+ html = f"<html><body><h2>Your Customized Video Marketing Plan</h2><p>{marketing_plan.replace('\n', '<br>')}</p></body></html>"
58
+ pdf = pdfkit.from_string(html, False)
59
+
60
+ st.download_button(
61
+ label="Download your plan as PDF",
62
+ data=pdf,
63
+ file_name="video_marketing_plan.pdf",
64
+ mime="application/octet-stream"
65
+ )