Spaces:
Runtime error
Runtime error
Duy-Anh Dang
commited on
Commit
·
eca4634
1
Parent(s):
82d1fcd
empty.container
Browse files
app.py
CHANGED
@@ -210,42 +210,42 @@ with st.expander('Adjust your tone intensities for your preference: '):
|
|
210 |
|
211 |
Loxz_recom_box = st.checkbox('Select Loxz Recommended Tones for Optimal Output')
|
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 |
if Loxz_recom_box == True:
|
250 |
recommended_changes=(best_target_tones)
|
251 |
change=best_target-pred
|
@@ -275,7 +275,8 @@ if st.button('Generate Predictions'):
|
|
275 |
fig2.update_layout(title_text=f'The following Changes will yield a {out} increase in {target}')
|
276 |
st.plotly_chart(fig2, use_container_width=True)
|
277 |
#FunctionsModelSA_V1.corrections(best_target_tones,test_predictions))
|
278 |
-
|
279 |
-
|
|
|
|
|
280 |
|
281 |
-
WHITE_SPACE(10)
|
|
|
210 |
|
211 |
Loxz_recom_box = st.checkbox('Select Loxz Recommended Tones for Optimal Output')
|
212 |
|
213 |
+
with st.empty().container():
|
214 |
+
if st.button('Generate Predictions'):
|
215 |
+
start_time = time.time()
|
216 |
+
if input_text == "":
|
217 |
+
st.error('Please enter a sentence!')
|
218 |
+
else:
|
219 |
+
placeholder = st.empty()
|
220 |
+
placeholder.text('Loading Data...')
|
221 |
+
|
222 |
+
# Starting predictions
|
223 |
+
bucket='emailcampaignmodeldata'
|
224 |
+
# file_key = 'fullEmailBody/fullemailtextbody_labeled_3rates_8tones_20220524.csv'
|
225 |
+
|
226 |
+
# email_data = utils.get_files_from_aws(bucket,file_key)
|
227 |
+
tone_key = 'ModelSADataSets/Tone_and_target.csv'
|
228 |
+
tone_data = FunctionsModelSA_V1.load_data()
|
229 |
+
test_predictions,tones = FunctionsModelSA_V1.convert_text_to_tone(input_text)
|
230 |
+
|
231 |
+
# st.dataframe(test_predictions)
|
232 |
+
# st.dataframe(tones)
|
233 |
+
campaign_val='campaign_type_'+ campaign
|
234 |
+
industry_val='industry_'+ industry
|
235 |
+
pred,lower,upper,model = FunctionsModelSA_V1.prediction(tones,campaign_val,industry_val,target)
|
236 |
+
worst_target,best_target,best_target_tones = FunctionsModelSA_V1.find_max_cat(tone_data,target,industry_val,campaign_val)
|
237 |
+
#best_target, best_target_tones
|
238 |
+
#FunctionsModelSA_V1.plot_CI(pred,lower,upper)
|
239 |
+
st.write('The Predicted Value is ' + str(pred))
|
240 |
+
fig1 = go.Figure(go.Bar(
|
241 |
+
name = 'Tone Levels',
|
242 |
+
x=[joyful_tone_value, confident_tone_value, urgent_tone_value, friendly_tone_value, optimistic_tone_value, analytical_tone_value, casual_tone_value],
|
243 |
+
y=['Joyful', 'Confident', 'Urgent', 'Friendly', 'Optimistic', 'Analytical', 'Casual'],
|
244 |
+
orientation='h')
|
245 |
+
)
|
246 |
+
st.plotly_chart(fig1, use_container_width=True)
|
247 |
+
|
248 |
+
#if((best_target!=0) and (pred<best_target)):
|
249 |
if Loxz_recom_box == True:
|
250 |
recommended_changes=(best_target_tones)
|
251 |
change=best_target-pred
|
|
|
275 |
fig2.update_layout(title_text=f'The following Changes will yield a {out} increase in {target}')
|
276 |
st.plotly_chart(fig2, use_container_width=True)
|
277 |
#FunctionsModelSA_V1.corrections(best_target_tones,test_predictions))
|
278 |
+
|
279 |
+
placeholder.empty()
|
280 |
+
|
281 |
+
WHITE_SPACE(10)
|
282 |
|
|