nniehaus commited on
Commit
44ea91a
·
verified ·
1 Parent(s): de62fb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -35
app.py CHANGED
@@ -2,21 +2,18 @@ import streamlit as st
2
  import openai
3
 
4
  # Initializing Streamlit app
5
- st.title("Video Script Generator for Small Businesses")
6
 
7
- # Accessing the OpenAI API key securely
8
  openai.api_key = st.secrets["OPENAI_API_KEY"]
9
 
10
- # Function to call OpenAI API
11
  def call_openai_api(prompt):
12
  try:
13
  response = openai.ChatCompletion.create(
14
- model="gpt-4o",
15
  messages=[
16
- {
17
- "role": "system",
18
- "content": prompt['system']
19
- },
20
  {"role": "user", "content": prompt['user']}
21
  ]
22
  )
@@ -26,38 +23,26 @@ def call_openai_api(prompt):
26
  return None
27
 
28
  # Streamlit UI for input
29
- business_description = st.text_area("Describe your business or video topic/idea:", placeholder="e.g., We are a local bakery specializing in gluten-free pastries.")
30
- problem_solved = st.text_input("What problem do you solve for your customers?", placeholder="e.g., Making gluten-free living delicious and easy.")
31
- services_offered = st.text_input("What services do you want to mention in your video?", placeholder="e.g., Custom gluten-free cakes for special occasions.")
32
- unique_aspects = st.text_input("What makes you unique or separates you from others in your industry?", placeholder="e.g., Our secret family recipes.")
33
- name_to_include = st.text_input("List any names (your name or business name) you want to include in the video.", placeholder="e.g., 123 Custom Blinds or Mary Smith")
34
- call_to_action = st.text_input("How do you want to be contacted? (Provide one call to action)", placeholder="e.g., Visit our bakery on Main Street.")
35
- script_length = st.number_input("Desired script length (maximum word count):", min_value=50, max_value=250, value=150, step=10)
36
 
37
- generate_button = st.button('Generate Video Script')
38
 
39
- # Handling button click
40
  if generate_button:
41
- # Creating the prompt as a dictionary
42
  user_prompt = {
43
  "system": """
44
- Act as a small business marketing video script writer. You respond with fully written video scripts that contain only the words that should be read out
45
- loud into the camera. The scripts you create do not include shot directions, references to who is speaking, or any other extraneous notes that are not the actual
46
- words that should be read out loud. As a small business video marketing expert, you have studied the most effective marketing and social media videos made by small
47
- businesses. The video scripts are short, always coming in under the specified maximum word count. They always begin with engaging opening lines that tease what the
48
- rest of the video is about and they end with a single strong call to action.""",
49
  "user": f"""
50
- Industry: {business_description}
51
- Problem Solved: {problem_solved}
52
- Services Offered: {services_offered}
53
- Unique Aspects: {unique_aspects}
54
- Names to Include: {name_to_include}
55
- Call to Action: {call_to_action}
56
- Script Length: {script_length} words maximum."""
57
  }
58
- script = call_openai_api(user_prompt)
59
- if script:
60
- st.markdown("### Generated Video Script")
61
- st.write(script)
62
  else:
63
- st.write("An error occurred while generating the script. Please try again.")
 
2
  import openai
3
 
4
  # Initializing Streamlit app
5
+ st.title("AI Integration Assessment for Businesses")
6
 
7
+ # Securely accessing the OpenAI API key
8
  openai.api_key = st.secrets["OPENAI_API_KEY"]
9
 
10
+ # Function to call OpenAI API using GPT-4o
11
  def call_openai_api(prompt):
12
  try:
13
  response = openai.ChatCompletion.create(
14
+ model="gpt-4o", # Specify GPT-4o as the model
15
  messages=[
16
+ {"role": "system", "content": prompt['system']},
 
 
 
17
  {"role": "user", "content": prompt['user']}
18
  ]
19
  )
 
23
  return None
24
 
25
  # Streamlit UI for input
26
+ business_type = st.text_input("Describe your business type and main activities:", "e.g., Manufacturing")
27
+ current_tech_usage = st.text_input("Describe current technology usage in your business:", "e.g., Mostly manual processes with some Excel usage")
28
+ ai_interest_areas = st.multiselect("Select potential areas for AI integration:",
29
+ ["Customer Service", "Operations", "Marketing", "Risk Management", "Product Development"])
 
 
 
30
 
31
+ generate_button = st.button('Generate AI Integration Report')
32
 
33
+ # Handling the button click
34
  if generate_button:
 
35
  user_prompt = {
36
  "system": """
37
+ You are an AI consultant tasked with evaluating a business to determine where AI can be effectively integrated. Provide a detailed report that assesses the current technology usage and recommends areas for AI implementation based on the business type and interests.""",
 
 
 
 
38
  "user": f"""
39
+ Business Type: {business_type}
40
+ Current Technology Usage: {current_tech_usage}
41
+ Interest Areas: {', '.join(ai_interest_areas)}"""
 
 
 
 
42
  }
43
+ report = call_openai_api(user_prompt)
44
+ if report:
45
+ st.markdown("### AI Integration Report")
46
+ st.write(report)
47
  else:
48
+ st.write("An error occurred while generating the report. Please try again.")