Anne31415 commited on
Commit
3d69dee
·
1 Parent(s): 5efe4f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -9
app.py CHANGED
@@ -27,8 +27,8 @@ pdf_file_path = "Private_Book/KOMBI_all2.pdf" # Replace with your PDF file path
27
  def cloud_button(label, key=None, color=None):
28
  button_id = f"cloud-button-{key or label}"
29
  color_class = f"color-{color}" if color else ""
30
- num_circles = max(3, min(12, len(label) // 4)) # Adjust the number of circles based on text length
31
- circle_size = 60
32
 
33
  # Generate circles
34
  circles_html = ''.join([
@@ -51,26 +51,27 @@ def cloud_button(label, key=None, color=None):
51
  .wrapper {{
52
  display: flex;
53
  align-items: center;
54
- background-color: #9BBEFF;
55
- border-radius: 30px; # Adjust as needed
56
- padding: 10px 20px;
57
  }}
58
  .text {{
59
  position: relative;
60
  font-weight: bold;
61
  z-index: 2;
 
 
 
62
  }}
63
  .circle {{
64
  background-color: #9BBEFF;
65
  border-radius: 50%;
66
  width: {circle_size}px;
67
  height: {circle_size}px;
68
- margin: 0 -{circle_size // 4}px; # Adjust negative margin for overlap
69
  z-index: 1;
70
  }}
71
- .color-1 .wrapper, .color-1 .circle {{ background-color: #FFA07A; }}
72
- .color-2 .wrapper, .color-2 .circle {{ background-color: #FF7F50; }}
73
- .color-3 .wrapper, .color-3 .circle {{ background-color: #FF6347; }}
74
  </style>
75
  <script>
76
  document.getElementById("{button_id}").onclick = function() {{
@@ -84,6 +85,11 @@ cloud_button("Short Text", color="1")
84
  cloud_button("This is a longer piece of text", color="2")
85
  cloud_button("This is an even longer piece of text to test the cloud button", color="3")
86
 
 
 
 
 
 
87
  def load_pdf(file_path):
88
  pdf_reader = PdfReader(file_path)
89
  text = ""
 
27
  def cloud_button(label, key=None, color=None):
28
  button_id = f"cloud-button-{key or label}"
29
  color_class = f"color-{color}" if color else ""
30
+ num_circles = max(3, min(12, len(label) // 2)) # Adjust the number of circles based on text length
31
+ circle_size = 30 # Size of the circles
32
 
33
  # Generate circles
34
  circles_html = ''.join([
 
51
  .wrapper {{
52
  display: flex;
53
  align-items: center;
54
+ position: relative;
 
 
55
  }}
56
  .text {{
57
  position: relative;
58
  font-weight: bold;
59
  z-index: 2;
60
+ background-color: #9BBEFF;
61
+ border-radius: 15px;
62
+ padding: 5px 10px;
63
  }}
64
  .circle {{
65
  background-color: #9BBEFF;
66
  border-radius: 50%;
67
  width: {circle_size}px;
68
  height: {circle_size}px;
69
+ margin: 0 -{circle_size // 3}px;
70
  z-index: 1;
71
  }}
72
+ .color-1 .text, .color-1 .circle {{ background-color: #FFA07A; }}
73
+ .color-2 .text, .color-2 .circle {{ background-color: #FF7F50; }}
74
+ .color-3 .text, .color-3 .circle {{ background-color: #FF6347; }}
75
  </style>
76
  <script>
77
  document.getElementById("{button_id}").onclick = function() {{
 
85
  cloud_button("This is a longer piece of text", color="2")
86
  cloud_button("This is an even longer piece of text to test the cloud button", color="3")
87
 
88
+
89
+ cloud_button("Short Text", color="1")
90
+ cloud_button("This is a longer piece of text", color="2")
91
+ cloud_button("This is an even longer piece of text to test the cloud button", color="3")
92
+
93
  def load_pdf(file_path):
94
  pdf_reader = PdfReader(file_path)
95
  text = ""