Anne31415 commited on
Commit
0c906d3
·
1 Parent(s): 539160e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -26,22 +26,26 @@ pdf_file_path = "Private_Book/KOMBI_all2.pdf" # Replace with your PDF file path
26
  def cloud_button(label, key=None, color=None):
27
  button_id = f"cloud-button-{key or label}"
28
  color_class = f"color-{color}" if color else ""
 
 
 
 
 
 
 
 
 
 
29
  cloud_button_html = f"""
30
  <div class="cloud {color_class}" id="{button_id}" style="margin-bottom: 20px;">
31
- <div class="circle" style="width: 80px; height: 80px; left: -60px;"></div>
32
- <div class="circle" style="width: 70px; height: 70px; left: -45px;"></div>
33
- <div class="circle" style="width: 60px; height: 60px; left: -30px;"></div>
34
- <div class="circle" style="width: 50px; height: 50px; left: -15px;"></div>
35
  <div class="rectangle">{label}</div>
36
- <div class="circle" style="width: 50px; height: 50px; right: -15px;"></div>
37
- <div class="circle" style="width: 60px; height: 60px; right: -30px;"></div>
38
- <div class="circle" style="width: 70px; height: 70px; right: -45px;"></div>
39
- <div class="circle" style="width: 80px; height: 80px; right: -60px;"></div>
40
  </div>
41
  <style>
42
  .cloud {{
43
  position: relative;
44
- display: inline-block;
45
  cursor: pointer;
46
  user-select: none;
47
  font-size: 16px;
@@ -66,10 +70,11 @@ def cloud_button(label, key=None, color=None):
66
  background-color: #f8f9fa;
67
  z-index: 1;
68
  border-radius: 50%;
 
 
69
  top: 50%;
70
  transform: translateY(-50%);
71
  }}
72
-
73
  .cloud:hover .rectangle {{
74
  background-color: #008CBA;
75
  color: white;
@@ -90,6 +95,7 @@ def cloud_button(label, key=None, color=None):
90
  st.markdown(cloud_button_html, unsafe_allow_html=True)
91
 
92
 
 
93
  def load_pdf(file_path):
94
  pdf_reader = PdfReader(file_path)
95
  text = ""
 
26
  def cloud_button(label, key=None, color=None):
27
  button_id = f"cloud-button-{key or label}"
28
  color_class = f"color-{color}" if color else ""
29
+
30
+ # Calculate the number of circles needed based on the length of the text
31
+ num_circles = len(label) // 2
32
+
33
+ # Create the circles on the left side of the rectangle
34
+ left_circles = ''.join([f'<div class="circle" style="left: {-15 * (i + 1)}px;"></div>' for i in range(num_circles)])
35
+
36
+ # Create the circles on the right side of the rectangle
37
+ right_circles = ''.join([f'<div class="circle" style="right: {-15 * (i + 1)}px;"></div>' for i in range(num_circles)])
38
+
39
  cloud_button_html = f"""
40
  <div class="cloud {color_class}" id="{button_id}" style="margin-bottom: 20px;">
41
+ {left_circles}
 
 
 
42
  <div class="rectangle">{label}</div>
43
+ {right_circles}
 
 
 
44
  </div>
45
  <style>
46
  .cloud {{
47
  position: relative;
48
+ display: inline-flex;
49
  cursor: pointer;
50
  user-select: none;
51
  font-size: 16px;
 
70
  background-color: #f8f9fa;
71
  z-index: 1;
72
  border-radius: 50%;
73
+ width: 30px;
74
+ height: 30px;
75
  top: 50%;
76
  transform: translateY(-50%);
77
  }}
 
78
  .cloud:hover .rectangle {{
79
  background-color: #008CBA;
80
  color: white;
 
95
  st.markdown(cloud_button_html, unsafe_allow_html=True)
96
 
97
 
98
+
99
  def load_pdf(file_path):
100
  pdf_reader = PdfReader(file_path)
101
  text = ""