Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -26,29 +26,33 @@ 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 |
-
|
30 |
-
# Calculate the number of circles needed based on the length of the text
|
31 |
num_circles = max(len(label) // 2, 3) # Ensure at least 3 circles for shorter text
|
32 |
|
33 |
-
#
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
cloud_button_html = f"""
|
37 |
<div class="cloud {color_class}" id="{button_id}" style="margin-bottom: 20px;">
|
38 |
-
{
|
39 |
<div class="rectangle">{label}</div>
|
40 |
-
{
|
41 |
</div>
|
42 |
<style>
|
43 |
.cloud {{
|
44 |
position: relative;
|
45 |
display: inline-flex;
|
|
|
46 |
cursor: pointer;
|
47 |
user-select: none;
|
48 |
font-size: 16px;
|
49 |
-
background-color: #f8f9fa;
|
50 |
white-space: nowrap;
|
51 |
-
|
52 |
}}
|
53 |
.rectangle {{
|
54 |
min-width: 120px;
|
@@ -64,14 +68,12 @@ def cloud_button(label, key=None, color=None):
|
|
64 |
transition: background-color 0.4s;
|
65 |
}}
|
66 |
.circle {{
|
67 |
-
position: relative;
|
68 |
background-color: #f8f9fa;
|
69 |
-
z-index: 1;
|
70 |
border-radius: 50%;
|
71 |
width: 30px;
|
72 |
height: 30px;
|
73 |
-
|
74 |
-
|
75 |
}}
|
76 |
.cloud:hover .rectangle {{
|
77 |
background-color: #008CBA;
|
|
|
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 |
num_circles = max(len(label) // 2, 3) # Ensure at least 3 circles for shorter text
|
30 |
|
31 |
+
# Calculate spacing based on the number of circles
|
32 |
+
spacing = 20 // num_circles
|
33 |
+
|
34 |
+
# Create circles on the left side
|
35 |
+
left_circles = ''.join([f'<div class="circle" style="margin-left: {-spacing * i}px;"></div>' for i in range(num_circles)])
|
36 |
+
|
37 |
+
# Create circles on the right side
|
38 |
+
right_circles = ''.join([f'<div class="circle" style="margin-right: {-spacing * i}px;"></div>' for i in range(num_circles)])
|
39 |
|
40 |
cloud_button_html = f"""
|
41 |
<div class="cloud {color_class}" id="{button_id}" style="margin-bottom: 20px;">
|
42 |
+
{left_circles}
|
43 |
<div class="rectangle">{label}</div>
|
44 |
+
{right_circles}
|
45 |
</div>
|
46 |
<style>
|
47 |
.cloud {{
|
48 |
position: relative;
|
49 |
display: inline-flex;
|
50 |
+
align-items: center;
|
51 |
cursor: pointer;
|
52 |
user-select: none;
|
53 |
font-size: 16px;
|
|
|
54 |
white-space: nowrap;
|
55 |
+
background-color: #f8f9fa;
|
56 |
}}
|
57 |
.rectangle {{
|
58 |
min-width: 120px;
|
|
|
68 |
transition: background-color 0.4s;
|
69 |
}}
|
70 |
.circle {{
|
|
|
71 |
background-color: #f8f9fa;
|
|
|
72 |
border-radius: 50%;
|
73 |
width: 30px;
|
74 |
height: 30px;
|
75 |
+
position: relative;
|
76 |
+
z-index: 1;
|
77 |
}}
|
78 |
.cloud:hover .rectangle {{
|
79 |
background-color: #008CBA;
|