Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -25,16 +25,23 @@ pdf_file_path = "Private_Book/KOMBI_all2.pdf" # Replace with your PDF file path
|
|
25 |
|
26 |
|
27 |
|
|
|
|
|
28 |
def cloud_button(label, key=None, color=None):
|
29 |
button_id = f"cloud-button-{key or label}"
|
30 |
color_class = f"color-{color}" if color else ""
|
31 |
num_circles = max(3, min(12, len(label) // 4)) # Adjust the number of circles based on text length
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
# Generate circles on both sides of the text
|
34 |
circles_html = ''.join([
|
35 |
-
f'<div class="circle {color_class}" style="margin-right: -
|
36 |
] + [
|
37 |
-
f'<div class="circle {color_class}" style="margin-left: -
|
38 |
])
|
39 |
|
40 |
cloud_button_html = f"""
|
@@ -67,8 +74,8 @@ def cloud_button(label, key=None, color=None):
|
|
67 |
}}
|
68 |
.circle {{
|
69 |
border-radius: 50%;
|
70 |
-
width:
|
71 |
-
height:
|
72 |
position: relative;
|
73 |
z-index: 1;
|
74 |
}}
|
@@ -88,9 +95,9 @@ def cloud_button(label, key=None, color=None):
|
|
88 |
"""
|
89 |
st.markdown(cloud_button_html, unsafe_allow_html=True)
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
|
95 |
|
96 |
def load_pdf(file_path):
|
|
|
25 |
|
26 |
|
27 |
|
28 |
+
import streamlit as st
|
29 |
+
|
30 |
def cloud_button(label, key=None, color=None):
|
31 |
button_id = f"cloud-button-{key or label}"
|
32 |
color_class = f"color-{color}" if color else ""
|
33 |
num_circles = max(3, min(12, len(label) // 4)) # Adjust the number of circles based on text length
|
34 |
|
35 |
+
# Calculate the overlap and spacing for the circles
|
36 |
+
circle_diameter = 60
|
37 |
+
overlap = 0.4 # 40% overlap
|
38 |
+
spacing = circle_diameter * (1 - overlap)
|
39 |
+
|
40 |
# Generate circles on both sides of the text
|
41 |
circles_html = ''.join([
|
42 |
+
f'<div class="circle {color_class}" style="margin-right: -{spacing}px;"></div>' for _ in range(num_circles//2)
|
43 |
] + [
|
44 |
+
f'<div class="circle {color_class}" style="margin-left: -{spacing}px;"></div>' for _ in range(num_circles//2)
|
45 |
])
|
46 |
|
47 |
cloud_button_html = f"""
|
|
|
74 |
}}
|
75 |
.circle {{
|
76 |
border-radius: 50%;
|
77 |
+
width: {circle_diameter}px;
|
78 |
+
height: {circle_diameter}px;
|
79 |
position: relative;
|
80 |
z-index: 1;
|
81 |
}}
|
|
|
95 |
"""
|
96 |
st.markdown(cloud_button_html, unsafe_allow_html=True)
|
97 |
|
98 |
+
cloud_button("Short Text", color="1")
|
99 |
+
cloud_button("This is a longer piece of text", color="2")
|
100 |
+
cloud_button("This is an even longer piece of text to test the cloud button", color="3")
|
101 |
|
102 |
|
103 |
def load_pdf(file_path):
|