|
import streamlit as st |
|
import openai |
|
|
|
|
|
openai.api_key = st.secrets["OPENAI_API_KEY"] |
|
|
|
st.title("Customer Avatar Generator") |
|
|
|
|
|
business_type = st.text_input("Business Type", "Enter the type of your business (e.g., Real Estate, E-commerce)") |
|
target_market = st.text_input("Target Market", "Describe your target market (e.g., first-time home buyers, fitness enthusiasts)") |
|
unique_selling_points = st.text_area("Unique Selling Points", "What sets your business apart from competitors? (e.g., personalized service, affordable pricing)") |
|
customer_challenges = st.text_area("Customer Challenges", "What challenges do your customers face that your business solves? (e.g., finding affordable housing, achieving fitness goals)") |
|
|
|
submit_button = st.button("Generate Customer Avatar") |
|
|
|
if submit_button: |
|
|
|
prompt = f""" |
|
Generate a detailed customer avatar for a business. |
|
Business Type: {business_type} |
|
Target Market: {target_market} |
|
Unique Selling Points: {unique_selling_points} |
|
Customer Challenges: {customer_challenges} |
|
""" |
|
|
|
|
|
try: |
|
response = openai.Completion.create( |
|
model="gpt-4", |
|
prompt=prompt, |
|
max_tokens=500, |
|
) |
|
|
|
avatar = response.choices[0].text.strip() |
|
|
|
|
|
st.subheader("Generated Customer Avatar") |
|
st.write(avatar) |
|
|
|
except Exception as e: |
|
st.error(f"An error occurred: {e}") |
|
|