File size: 12,487 Bytes
da5916b
c782181
44173cd
c782181
604214c
c782181
 
604214c
da5916b
 
 
 
 
 
4331889
 
da5916b
 
 
 
 
 
 
 
 
 
 
cba6638
 
 
 
 
 
604214c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4331889
cd7e0d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f08130b
cd7e0d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45290f3
 
 
 
 
6012647
 
bffe4e7
 
 
da5916b
f08130b
 
 
44173cd
 
 
f08130b
44173cd
5c1171e
 
f08130b
 
 
44173cd
5c1171e
 
f08130b
 
44173cd
f08130b
604214c
 
 
 
 
 
 
9809cd8
604214c
0c6560f
604214c
e9b921a
604214c
 
 
 
 
 
e9b921a
44173cd
f08130b
f1a1b65
9809cd8
 
 
 
 
 
e209a2d
604214c
e209a2d
f08130b
9809cd8
e9b921a
604214c
e9b921a
 
9809cd8
e9b921a
604214c
e9b921a
 
f08130b
9809cd8
f08130b
 
 
da5916b
44173cd
 
 
 
604214c
 
 
e9b921a
604214c
 
e9b921a
604214c
 
e9b921a
 
44173cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e8b5d00
44173cd
e8b5d00
 
 
 
44173cd
e8b5d00
44173cd
 
 
 
 
 
 
 
 
 
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
import streamlit as st
import os
import math
import google.generativeai as genai
GOOGLE_API_KEY=os.getenv('GEMINI_API_KEY')
genai.configure(api_key=GOOGLE_API_KEY)
model = genai.GenerativeModel(model_name = "gemini-pro")
from utils import findTop3MoneyNeeds, findTop3Topologies, findTop3CustomerExperienceNeeds, findTop3SustainabilityNeeds, listNeeds, generatePropositionExample


# Create a banner using Markdown
st.markdown(
    """
    <div style="min-width: 1000px;">
        <div style="background-color:#87CEEB;padding:10px;border-radius:10px;">
            <h1 style="color:white;text-align:center;">Blue AI</h1>
        </div>
        <div style="color:black;text-align:center;">
            <h1>Welcome to the Proposition Management Tool</h1>
        </div>
    </div>
    """,
    unsafe_allow_html=True
)

selectedCity = st.selectbox("Please select the City and the Bank Product for Your Proposition.", ["CharlesTown", "Limburg"])
selectedProduct = st.selectbox("Please select the Product", ["Current", "Mortage", "Credit Card", "Crypto"])
subscriberTakeOut = st.number_input("Please enter your subscriber take up target for year 1", min_value=0, step=1)

subscriberTakeOutYear2 = st.number_input("Please enter your subscriber take up target for year 2", min_value=0, step=1)

subscriberTakeOutYear3 = st.number_input("Please enter your subscriber take up target for year 3", min_value=0, step=1)

productName = st.text_input("Please enter your product name")

moneyNeedsList, moneyNeedsDict = listNeeds('money_needs')
customerExperienceList, customerExperienceDict = listNeeds('customer_exp')
sutainabilityNeedsList, sutainabilityNeedsDict = listNeeds('sustainability')

moneyNeeds = st.multiselect(
    label="Select three money needs of your target audience which best describe their spending",
    options=moneyNeedsList,
    max_selections=3
)

customerExperience = st.multiselect(
    label="Select three options which best describe the cuetomer experience you are targeting to provide",
    options=customerExperienceList,
    max_selections=3
)

sutainabilityNeeds = st.multiselect(
    label="Select three options which best describe the sustainability needs of your customer",
    options=sutainabilityNeedsList,
    max_selections=3
)


#moneyNeeds = st.text_area("Describe money needs of your target audience. For example do they spend a lot on education, healthcare, gym, eating out etc.")
#customerExperience = st.text_area("Describe the customer experience needs of your target audience.")
#sutainabilityNeeds = st.text_area("Describe the sutainability needs of your target audience.")

submit_button_details = st.button("Submit details to generate an example proposition")

userProposal = st.text_area("Enter your final Proposition for Select City and Product", value=st.session_state.get("propositionVal", ""), disabled=st.session_state.get("disabled", True))

submit_button_proposition = st.button("Submit Proposition")

pre_prompt = '''You are a business analyser bot. I will give you data and references and you will analyse the propositions and will give them scoring on particular criterias. An example is below

Proposition - Culture bank Student – the Young Professionals Credit Card!
Description:
Culture bank is offering Limburg residents a Credit card for students and under 30’s with special discounts at major online stores. The card offers a 1% off on all purchases from Amazon  and 10% off all travel purchases all available through our Mobile App. You will also get a free current account to use for your everyday savings too! This group are short on cash but not afraid to be in debt as they will pay it off in the future. They want a product that is easy to use and not complicated. They want connect on Social Media sites. They want great deals and want to manage things independantly. They want the brand to be fun and positive
The card is free with no annual fee and available via our online portal

Some more details about proposition
Question: What are their money needs?
Answer: This group are short on cash but not afraid to be in debt as they will pay it off in the future
Question: What is thee customer experience
Answer: They want a product that is easy to use and not complicated
Question: what is the key demographic behaviour?
Answer: They want connect on Social Media sites
Question: Prime Money Attitudes?
Answer: They want great deals and want to manage things independantly
Question: Brand needs?sss
Answer: They want the brand to be fun and positive

Analyse this proposition and score it on the below criteria based upon its popularity within the audience 'Living of today'
Refer the barometer goals being set for 'Living for today people'

I want to feel socially responsible 67
I want to feel in control of my future 58
I want the bank to help me understand what I can afford 93
I do active charity work 99
I want to manage my carbon footprint 112
Being rich is a priority for me 86
I have achieved all I need in life 52
I feel out of depth with my finances 103
Helps me gain control over my future 97
The brand is fun 120

Rank the proposition on all the above barometers based upon how much they match with the barometer with semantic similarity. Rank should be decided by this logic-
1. Score should be between 0 - 200.
2. On the basis of score then rank the proposition on all benchmark goals from 1(low) to 5(high).
3. If the score of proposition differ from the goal within the range 0-10 then it should have higher rank. Similarly as the difference increases from goal value the rank should be lower.

Show the rank between 1 to 5 and the score between 0-200 for every goal in a tabular format with a sum total and average rank at the end of table.
Only show the table and conclusion remarks if the proposition suits the target audience or not. Do not show the barometers or any other part of the prompt 

{{0}}
'''

CharlesTownDemographic = '''CharlesTown city people are Living for today people mostly with a population of 10000. Out of this 65% are between the age of 18-25.'''
LimburgTownDemographic = '''Limburg city people are young families people mostly with a population of 20000. Out of this 65% are between the age of 30-45. Most of them have kids aged between 0-15'''

CharlesTownPopulation = 10000
LimburgTownPopulation = 20000 

demographic = ''
population = 0
if selectedCity:
    if selectedCity == 'CharlesTown':

        st.write(CharlesTownDemographic)
        demographic = CharlesTownDemographic
        population = CharlesTownPopulation
    
    if selectedCity == 'Limburg':
        st.write(LimburgTownDemographic)
        demographic = LimburgTownDemographic
        population = LimburgTownPopulation

if submit_button_details:
    st.session_state.disabled = False
    

    #topMoneyNeeds = moneyNeeds #findTop3MoneyNeeds(moneyNeeds)

    #topCustomerExp = customerExperience #findTop3CustomerExperienceNeeds(customerExperience)

    #topSustainabilityNeeds = sutainabilityNeeds #findTop3SustainabilityNeeds(sutainabilityNeeds)

    st.session_state.propositionVal = generatePropositionExample(productName, selectedProduct, moneyNeeds, customerExperience, sutainabilityNeeds)

    

if submit_button_proposition:
    proposal = '''Given proposal is for the city {} with product {}. The propsal is as below.
    {}'''
    proposal = proposal.format(selectedCity, selectedProduct, userProposal)

    matchingTopologies, topologyDetails = findTop3Topologies(proposal, demographic)

    response = model.generate_content([pre_prompt.format(proposal)])

    st.write("{} city people are mainly from the {} group with a population of {}. Out of this {} of perople belong to this group".format(selectedCity, matchingTopologies[0], population, topologyDetails[matchingTopologies[0]]['Proportion Sample']))
    st.write("Entered proposal:", proposal)
    st.write("Analyzing your proposition")

    st.write("As for the money needs of this group your product is mostly targeting people with the spending behaviour described below:")
    
    for idx, need in enumerate(moneyNeeds):
        st.write("{}. {}".format(idx+1, need))

    st.write("As for the customer experience needs of this group your product is mostly targeting people with the spending behaviour described below:",)
    
    for idx, exp in enumerate(customerExperience):
        st.write("{}. {}".format(idx+1, exp))

    st.write("As for the sustainability needs of this group your product is mostly targeting people with the spending behaviour described below:",)
    
    for idx, need in enumerate(sutainabilityNeeds):
        st.write("{}. {}".format(idx+1, need))


    st.write("Overall your targeted demographic and proposition are focusing the three topologies below. The figures show the weighting of your proposition to each demographic:",)
    
    for idx, topology in enumerate(matchingTopologies):
        st.write("{}. {}".format(idx+1, topology))

    topologySumDict = {}

    for topology in matchingTopologies:
        sumTopology = 0
        for moneyNeed in moneyNeeds:
            #print(" Money need = {}, Topology is {}".format(moneyNeed, topology))
            sumTopology = sumTopology+int(moneyNeedsDict[moneyNeed][topology])
        
        for customerExp in customerExperience:
            sumTopology = sumTopology+int(customerExperienceDict[customerExp][topology])

        for sustainabilityNeed in sutainabilityNeeds:
            sumTopology = sumTopology+int(sutainabilityNeedsDict[sustainabilityNeed][topology])

        topologySumDict[topology] = math.floor(sumTopology/3)

    for topology in matchingTopologies:
        st.write("{}. {}".format(topology, topologySumDict[topology]))

    totalSubscriberTakeOut = 0
    for topology in matchingTopologies:
        proportion = int(topologyDetails[topology]['Proportion Sample'].replace('%', ''))
        topologyPopulation = math.floor((proportion * population) / 100)

        topologyScore = topologySumDict[topology]

        topologyPopulation = math.floor(topologyPopulation/2)
        if topologyScore <=250:
            topologyPopulation = topologyPopulation/2

        elif topologyScore >250 and topologyScore<=260:
            topologyPopulation = math.floor(topologyPopulation/1.8)
        
        elif topologyScore >260 and topologyScore<=270:
            topologyPopulation = math.floor(topologyPopulation/1.6)

        elif topologyScore >270 and topologyScore<=280:
            topologyPopulation = math.floor(topologyPopulation/1.4)

        elif topologyScore >280 and topologyScore<=300:
            topologyPopulation = topologyPopulation
        
        elif topologyScore >300 and topologyScore<=310:
            topologyPopulation = math.floor(topologyPopulation * 1.2)

        elif topologyScore >310 and topologyScore<=320:
            topologyPopulation = math.floor(topologyPopulation * 1.4)
        
        elif topologyScore >320 and topologyScore<=340:
            topologyPopulation = math.floor(topologyPopulation * 1.5)
        
        elif topologyScore >340 and topologyScore<=360:
            topologyPopulation = math.floor(topologyPopulation * 1.6)
        
        else:
             topologyPopulation = math.floor(topologyPopulation * 2)

        totalSubscriberTakeOut = totalSubscriberTakeOut + topologyPopulation
        st.write("{}. {} and has subscriber takeout of {}".format(topology, topologySumDict[topology], topologyPopulation))

    st.write(" Target Subscriber takeout = {}".format(totalSubscriberTakeOut))
    st.write(" Total Subscriber take up for Year 3 = {}".format(subscriberTakeOutYear3))

    if totalSubscriberTakeOut<subscriberTakeOutYear3:
        st.write("Overall there is not a close match of your proposition to the main demographic. Takeout score difference = {}".format(subscriberTakeOutYear3-totalSubscriberTakeOut))
    elif totalSubscriberTakeOut==subscriberTakeOutYear3:
        st.write("Amazing! Your proposition  exactly match the target subscriber take oup for year 3")
    else:
        st.write("Great Job! Your proposition exceeds the target subscriber take up for year 3. Additional takeout = {}".format(totalSubscriberTakeOut- subscriberTakeOutYear3))

# 250 and below with a negative factor of 2.0
# 260 with a negative factor of 1.8
# 270 with a negative factor of 1.6
# 280 with a negative factor of 1.0
# 300 with a factor of 1
# 310 with a factor of 1.2
# 320 with a factor of 1.4
# 340 with a factor or 1.5
# 360+ with a factor of 2.0