Duy-Anh Dang commited on
Commit
47382c7
·
1 Parent(s): 5e2e1e9

testing with container

Browse files
Files changed (1) hide show
  1. app.py +25 -24
app.py CHANGED
@@ -241,29 +241,30 @@ if st.button('Generate Predictions'):
241
  recommended_changes=(best_target_tones)
242
  change=best_target-pred
243
  #recommend(tones,recommended_changes,change,target)
244
- fig2 = go.Figure()
245
- fig2.add_trace(go.Bar(
246
- y=tone_labels,
247
- x=recommended_changes,
248
- name='Recommend changes',
249
- orientation='h',
250
- text=np.round(recommended_changes,3),
251
- width=.5,
252
- marker=dict(
253
- color='#e60f00',
254
- line=dict(color='rgba(58, 71, 80, 1.0)', width=1)))
255
- )
256
- fig2.update_traces(textfont_size=18, textposition="outside", cliponaxis=False)
257
- if target == 'Revenue_Per_Email':
258
- out = f"${round(change,2)}"
259
- st.write("The output will be between the range " + str(round(lower,2)) + ' and ' + str(round(upper,2)))
260
- st.write("The Predicted "+str(target) +" is "+ str(round(pred,2)))
261
- else:
262
- out = f"{round(change,2)*100}%"
263
- st.write("The output will be between the range " + str(round(lower,2) * 100) + ' and ' + str(round(upper,2) *100))
264
- st.write("The Predicted "+str(target) +" is "+ str(round(pred,2)*100))
265
- fig2.update_layout(title_text=f'The following Changes will yield a {out} increase in {target}')
266
- st.plotly_chart(fig2, use_container_width=True)
267
- #FunctionsModelSA_V1.corrections(best_target_tones,test_predictions))
 
268
 
269
  placeholder.empty()
 
241
  recommended_changes=(best_target_tones)
242
  change=best_target-pred
243
  #recommend(tones,recommended_changes,change,target)
244
+ with st.container():
245
+ fig2 = go.Figure()
246
+ fig2.add_trace(go.Bar(
247
+ y=tone_labels,
248
+ x=recommended_changes,
249
+ name='Recommend changes',
250
+ orientation='h',
251
+ text=np.round(recommended_changes,3),
252
+ width=.5,
253
+ marker=dict(
254
+ color='#e60f00',
255
+ line=dict(color='rgba(58, 71, 80, 1.0)', width=1)))
256
+ )
257
+ fig2.update_traces(textfont_size=18, textposition="outside", cliponaxis=False)
258
+ if target == 'Revenue_Per_Email':
259
+ out = f"${round(change,2)}"
260
+ st.write("The output will be between the range " + str(round(lower,2)) + ' and ' + str(round(upper,2)))
261
+ st.write("The Predicted "+str(target) +" is "+ str(round(pred,2)))
262
+ else:
263
+ out = f"{round(change,2)*100}%"
264
+ st.write("The output will be between the range " + str(round(lower,2) * 100) + ' and ' + str(round(upper,2) *100))
265
+ st.write("The Predicted "+str(target) +" is "+ str(round(pred,2)*100))
266
+ fig2.update_layout(title_text=f'The following Changes will yield a {out} increase in {target}')
267
+ st.plotly_chart(fig2, use_container_width=True)
268
+ #FunctionsModelSA_V1.corrections(best_target_tones,test_predictions))
269
 
270
  placeholder.empty()