cd14 commited on
Commit
4939927
·
1 Parent(s): f70db9f

bug fixing for df_recom_extra

Browse files
Files changed (1) hide show
  1. app.py +25 -15
app.py CHANGED
@@ -42,20 +42,20 @@ def create_image(width, height, rgb_color=(0, 0, 0)):
42
  image[:] = color
43
  return image
44
 
45
- def add_text(image, cta_txt):
46
- font = cv2.FONT_HERSHEY_SIMPLEX
47
- # fontScale
48
- fontScale = 1
49
- # Blue color in BGR
50
- color = (0, 0, 255)
51
 
52
- # Line thickness of 2 px
53
- h=img.shape[0]/2
54
- w=img.shape[1]/2
55
- thickness = 2
56
- image = cv2.putText(image, cta_txt, (h,w), font,
57
- fontScale, color, thickness, cv2.LINE_AA)
58
- return image
59
 
60
  def add_bg_from_url():
61
  st.markdown(
@@ -456,10 +456,20 @@ def select_cta_button(ccolor, text):
456
  for x in np.arange(len(st.session_state.ccolor)):
457
  color_rgb=get_rgb(str(st.session_state.ccolor[x]))
458
  color_img=create_image(100,30,color_rgb)
459
- color_img=add_text(color_img,"Call_To_Action text: "+str(st.session_state.text[x]))
 
 
 
 
 
 
 
 
 
 
460
  st.image(color_img, channels='BGR')
461
  # ctab=st.button("Call_To_Action text: "+str(st.session_state.text[x])+"; color: "+str(st.session_state.ccolor[x]), key = x)
462
- ctab=st.button("Select This CTA button to optimize", key = x)
463
  res=[]
464
  res.append(x)
465
  val={}
 
42
  image[:] = color
43
  return image
44
 
45
+ # def add_text(image, cta_txt):
46
+ # font = cv2.FONT_HERSHEY_SIMPLEX
47
+ # # fontScale
48
+ # fontScale = 1
49
+ # # Blue color in BGR
50
+ # color = (0, 0, 255)
51
 
52
+ # # Line thickness of 2 px
53
+ # h=image.shape[0]/2
54
+ # w=image.shape[1]/2
55
+ # thickness = 2
56
+ # image = cv2.putText(image, cta_txt, (h,w), font,
57
+ # fontScale, color, thickness, cv2.LINE_AA)
58
+ # return image
59
 
60
  def add_bg_from_url():
61
  st.markdown(
 
456
  for x in np.arange(len(st.session_state.ccolor)):
457
  color_rgb=get_rgb(str(st.session_state.ccolor[x]))
458
  color_img=create_image(100,30,color_rgb)
459
+ # color_img=add_text(color_img,"Call_To_Action text: "+str(st.session_state.text[x]))
460
+ col1, col2, col3 = st.columns([1,1,1])
461
+ with col3:
462
+ # st.button('1')
463
+ st.markdown('##### Call_To_Action text: {}'.format(str(st.session_state.text[x])))
464
+ with col2:
465
+ # st.button('2')
466
+ st.image(color_img, channels='BGR')
467
+ with col1:
468
+ ctab=st.button("Select This CTA button to optimize", key = x)
469
+
470
  st.image(color_img, channels='BGR')
471
  # ctab=st.button("Call_To_Action text: "+str(st.session_state.text[x])+"; color: "+str(st.session_state.ccolor[x]), key = x)
472
+ # ctab=st.button("Select This CTA button to optimize", key = x)
473
  res=[]
474
  res.append(x)
475
  val={}