cd14 commited on
Commit
408497e
·
1 Parent(s): c06b4d2

updating select_cta_button

Browse files
Files changed (2) hide show
  1. .DS_Store +0 -0
  2. app.py +9 -4
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
app.py CHANGED
@@ -414,9 +414,13 @@ def select_cta_button(ccolor, text):
414
  st.write('Select which Call-To-Action button(s) you would like to analyze: \n')
415
 
416
  #st.write(st.session_state)
 
417
  for x in np.arange(len(st.session_state.ccolor)):
418
- st.button(st.session_state.ccolor[x], key = x)
419
- def toggle_all(change):
 
 
 
420
  for cb in user_input:
421
  cb.value = select_all.value
422
 
@@ -440,7 +444,7 @@ def select_cta_button(ccolor, text):
440
 
441
  select_all.observe(toggle_all)
442
 
443
- return user_input
444
 
445
  def save_state():
446
  if uploaded_file is not None:
@@ -594,9 +598,10 @@ def get_predictions(selected_variable, selected_industry, selected_campaign,
594
  output_rate = predicted_rate
595
 
596
  if output_rate < 0:
597
- print("Sorry, Current model couldn't provide predictions on the target variable you selected.")
598
  else:
599
  print(f'\x1b[35m\nModel Prediction on the {selected_variable} is: \x1b[1m{round(output_rate*100, 2)}%\x1b[39m\x1b[22m')
 
600
  selected_industry_code = industry_code_dict.get(selected_industry)
601
  selected_campaign_code = campaign_code_dict.get(selected_campaign)
602
 
 
414
  st.write('Select which Call-To-Action button(s) you would like to analyze: \n')
415
 
416
  #st.write(st.session_state)
417
+ buttons_out=[]
418
  for x in np.arange(len(st.session_state.ccolor)):
419
+ bstyle="background-color: {}; color:{}; border-radius: 0.75rem;".format(st.session_state.ccolor[x],st.session_state.ccolor[x])
420
+ ctab=st.button("Call_To_Action text: "+str(st.session_state.text[x]), key = x, style=bstyle)
421
+ buttons_out.append(ctab)
422
+ return buttons_out
423
+ '''def toggle_all(change):
424
  for cb in user_input:
425
  cb.value = select_all.value
426
 
 
444
 
445
  select_all.observe(toggle_all)
446
 
447
+ return user_input'''
448
 
449
  def save_state():
450
  if uploaded_file is not None:
 
598
  output_rate = predicted_rate
599
 
600
  if output_rate < 0:
601
+ st.markdown("##### Sorry, Current model couldn't provide predictions on the target variable you selected.", unsafe_allow_html=True)
602
  else:
603
  print(f'\x1b[35m\nModel Prediction on the {selected_variable} is: \x1b[1m{round(output_rate*100, 2)}%\x1b[39m\x1b[22m')
604
+ st.markdown("##### Model Prediction on the {} is {}".format(selected_variable, round(output_rate*100, 2)), unsafe_allow_html=True)
605
  selected_industry_code = industry_code_dict.get(selected_industry)
606
  selected_campaign_code = campaign_code_dict.get(selected_campaign)
607