Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -29,18 +29,15 @@ def cloud_button(label, key=None, color=None):
|
|
29 |
num_circles = max(3, min(12, len(label) // 4))
|
30 |
circle_size = 60
|
31 |
|
32 |
-
# Calculate the overlap based on the circle size
|
33 |
-
overlap = circle_size * 0.4
|
34 |
-
|
35 |
circles_html = ''.join([
|
36 |
-
f'<div class="circle {color_class}"
|
37 |
])
|
38 |
|
39 |
cloud_button_html = f"""
|
40 |
<div class="cloud" id="{button_id}" style="margin-bottom: 20px;">
|
41 |
<div class="wrapper {color_class}">
|
42 |
-
<div class="text">{label}</div>
|
43 |
{circles_html}
|
|
|
44 |
</div>
|
45 |
</div>
|
46 |
<style>
|
@@ -54,25 +51,25 @@ def cloud_button(label, key=None, color=None):
|
|
54 |
display: flex;
|
55 |
align-items: center;
|
56 |
justify-content: center;
|
57 |
-
background-color: transparent;
|
58 |
position: relative;
|
|
|
59 |
}}
|
60 |
.text {{
|
61 |
position: relative;
|
62 |
font-weight: bold;
|
63 |
z-index: 2;
|
64 |
-
background-color: white; # Set the background color of the text
|
65 |
-
padding: 10px 20px;
|
66 |
-
border-radius: 30px;
|
67 |
}}
|
68 |
.circle {{
|
69 |
-
background-color: #FF6347;
|
70 |
border-radius: 50%;
|
71 |
width: {circle_size}px;
|
72 |
height: {circle_size}px;
|
73 |
position: absolute;
|
74 |
z-index: 1;
|
75 |
}}
|
|
|
|
|
|
|
76 |
</style>
|
77 |
<script>
|
78 |
document.getElementById("{button_id}").onclick = function() {{
|
@@ -88,6 +85,7 @@ cloud_button("This is a longer piece of text", color="2")
|
|
88 |
cloud_button("This is an even longer piece of text to test the cloud button", color="3")
|
89 |
|
90 |
|
|
|
91 |
def load_pdf(file_path):
|
92 |
pdf_reader = PdfReader(file_path)
|
93 |
text = ""
|
|
|
29 |
num_circles = max(3, min(12, len(label) // 4))
|
30 |
circle_size = 60
|
31 |
|
|
|
|
|
|
|
32 |
circles_html = ''.join([
|
33 |
+
f'<div class="circle {color_class}"></div>' for _ in range(num_circles)
|
34 |
])
|
35 |
|
36 |
cloud_button_html = f"""
|
37 |
<div class="cloud" id="{button_id}" style="margin-bottom: 20px;">
|
38 |
<div class="wrapper {color_class}">
|
|
|
39 |
{circles_html}
|
40 |
+
<div class="text">{label}</div>
|
41 |
</div>
|
42 |
</div>
|
43 |
<style>
|
|
|
51 |
display: flex;
|
52 |
align-items: center;
|
53 |
justify-content: center;
|
|
|
54 |
position: relative;
|
55 |
+
padding: 10px 20px;
|
56 |
}}
|
57 |
.text {{
|
58 |
position: relative;
|
59 |
font-weight: bold;
|
60 |
z-index: 2;
|
|
|
|
|
|
|
61 |
}}
|
62 |
.circle {{
|
63 |
+
background-color: #FF6347;
|
64 |
border-radius: 50%;
|
65 |
width: {circle_size}px;
|
66 |
height: {circle_size}px;
|
67 |
position: absolute;
|
68 |
z-index: 1;
|
69 |
}}
|
70 |
+
.color-1 .circle {{ background-color: #FFA07A; }}
|
71 |
+
.color-2 .circle {{ background-color: #FF7F50; }}
|
72 |
+
.color-3 .circle {{ background-color: #FF6347; }}
|
73 |
</style>
|
74 |
<script>
|
75 |
document.getElementById("{button_id}").onclick = function() {{
|
|
|
85 |
cloud_button("This is an even longer piece of text to test the cloud button", color="3")
|
86 |
|
87 |
|
88 |
+
|
89 |
def load_pdf(file_path):
|
90 |
pdf_reader = PdfReader(file_path)
|
91 |
text = ""
|