Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -26,21 +26,18 @@ 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 = len(label) // 2
|
32 |
-
|
33 |
-
# Create the circles on
|
34 |
-
|
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 |
-
{
|
42 |
<div class="rectangle">{label}</div>
|
43 |
-
{
|
44 |
</div>
|
45 |
<style>
|
46 |
.cloud {{
|
@@ -51,6 +48,7 @@ def cloud_button(label, key=None, color=None):
|
|
51 |
font-size: 16px;
|
52 |
background-color: #f8f9fa;
|
53 |
white-space: nowrap;
|
|
|
54 |
}}
|
55 |
.rectangle {{
|
56 |
min-width: 120px;
|
@@ -66,14 +64,14 @@ def cloud_button(label, key=None, color=None):
|
|
66 |
transition: background-color 0.4s;
|
67 |
}}
|
68 |
.circle {{
|
69 |
-
position:
|
70 |
background-color: #f8f9fa;
|
71 |
z-index: 1;
|
72 |
border-radius: 50%;
|
73 |
width: 30px;
|
74 |
height: 30px;
|
75 |
-
|
76 |
-
transform: translateY(
|
77 |
}}
|
78 |
.cloud:hover .rectangle {{
|
79 |
background-color: #008CBA;
|
@@ -96,6 +94,7 @@ def cloud_button(label, key=None, color=None):
|
|
96 |
|
97 |
|
98 |
|
|
|
99 |
def load_pdf(file_path):
|
100 |
pdf_reader = PdfReader(file_path)
|
101 |
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 = max(len(label) // 2, 3) # Ensure at least 3 circles for shorter text
|
32 |
+
|
33 |
+
# Create the circles on both sides of the rectangle
|
34 |
+
circles = ''.join([f'<div class="circle" style="margin-left: {-10 * (i + 1)}px;"></div>' for i in range(num_circles)])
|
35 |
+
|
|
|
|
|
|
|
36 |
cloud_button_html = f"""
|
37 |
<div class="cloud {color_class}" id="{button_id}" style="margin-bottom: 20px;">
|
38 |
+
{circles}
|
39 |
<div class="rectangle">{label}</div>
|
40 |
+
{circles}
|
41 |
</div>
|
42 |
<style>
|
43 |
.cloud {{
|
|
|
48 |
font-size: 16px;
|
49 |
background-color: #f8f9fa;
|
50 |
white-space: nowrap;
|
51 |
+
align-items: center;
|
52 |
}}
|
53 |
.rectangle {{
|
54 |
min-width: 120px;
|
|
|
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 |
+
display: inline-block;
|
74 |
+
transform: translateY(50%);
|
75 |
}}
|
76 |
.cloud:hover .rectangle {{
|
77 |
background-color: #008CBA;
|
|
|
94 |
|
95 |
|
96 |
|
97 |
+
|
98 |
def load_pdf(file_path):
|
99 |
pdf_reader = PdfReader(file_path)
|
100 |
text = ""
|