Anne31415 commited on
Commit
4e0fb75
·
1 Parent(s): 11e225c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -22
app.py CHANGED
@@ -23,27 +23,23 @@ repo.git_pull() # Pull the latest changes (if any)
23
  # Step 2: Load the PDF File
24
  pdf_file_path = "Private_Book/KOMBI_all2.pdf" # Replace with your PDF file path
25
 
26
-
27
  def cloud_button(label, key=None, color=None, overlap=20):
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))
31
  circle_size = 60
32
- text_size = 14 # Adjust the text font size as needed
33
 
34
- # Create circles with overlap
35
  circles_html = ''.join([
36
- f'<div class="circle {color_class}" style="margin-left: -{overlap * i}px;"></div>'
37
- for i in range(num_circles)
38
  ])
 
39
 
40
  cloud_button_html = f"""
41
  <div class="cloud" id="{button_id}" style="margin-bottom: 20px;">
42
  <div class="wrapper {color_class}">
43
- <div class="circle-container">
44
- {circles_html}
45
- </div>
46
- <div class="circle-text" style="font-size: {text_size}px;">{label}</div>
47
  </div>
48
  </div>
49
  <style>
@@ -60,24 +56,19 @@ def cloud_button(label, key=None, color=None, overlap=20):
60
  position: relative;
61
  padding: 10px 20px;
62
  }}
63
- .circle-container {{
64
- position: relative;
65
- display: flex;
66
- align-items: center;
67
- justify-content: center;
68
- }}
69
  .circle {{
70
  background-color: #FF6347;
71
  border-radius: 50%;
72
  width: {circle_size}px;
73
  height: {circle_size}px;
74
- position: absolute;
75
- z-index: 1;
76
  }}
77
  .circle-text {{
78
- position: relative;
 
 
 
79
  font-weight: bold;
80
- text-align: center;
81
  z-index: 2;
82
  }}
83
  .color-1 .circle {{ background-color: #FFA07A; }}
@@ -93,9 +84,10 @@ def cloud_button(label, key=None, color=None, overlap=20):
93
  st.markdown(cloud_button_html, unsafe_allow_html=True)
94
 
95
  # Example usage with a specified overlap value
96
- cloud_button("Short Text", color="1", overlap=40)
97
- cloud_button("This is a longer piece of text", color="2", overlap=60)
98
- cloud_button("This is an even longer piece of text to test the cloud button", color="3", overlap=80)
 
99
 
100
 
101
  def load_pdf(file_path):
 
23
  # Step 2: Load the PDF File
24
  pdf_file_path = "Private_Book/KOMBI_all2.pdf" # Replace with your PDF file path
25
 
 
26
  def cloud_button(label, key=None, color=None, overlap=20):
27
  button_id = f"cloud-button-{key or label}"
28
  color_class = f"color-{color}" if color else ""
29
  num_circles = max(3, min(12, len(label) // 4))
30
  circle_size = 60
 
31
 
32
+ # Create circles with text enclosed
33
  circles_html = ''.join([
34
+ f'<div class="circle {color_class}" style="margin-right: -{overlap}px;"></div>'
35
+ for _ in range(num_circles)
36
  ])
37
+ circles_html += f'<div class="circle-text">{label}</div>' # Add the text after the circles
38
 
39
  cloud_button_html = f"""
40
  <div class="cloud" id="{button_id}" style="margin-bottom: 20px;">
41
  <div class="wrapper {color_class}">
42
+ {circles_html}
 
 
 
43
  </div>
44
  </div>
45
  <style>
 
56
  position: relative;
57
  padding: 10px 20px;
58
  }}
 
 
 
 
 
 
59
  .circle {{
60
  background-color: #FF6347;
61
  border-radius: 50%;
62
  width: {circle_size}px;
63
  height: {circle_size}px;
64
+ position: relative;
 
65
  }}
66
  .circle-text {{
67
+ position: absolute;
68
+ top: 50%;
69
+ left: 50%;
70
+ transform: translate(-50%, -50%);
71
  font-weight: bold;
 
72
  z-index: 2;
73
  }}
74
  .color-1 .circle {{ background-color: #FFA07A; }}
 
84
  st.markdown(cloud_button_html, unsafe_allow_html=True)
85
 
86
  # Example usage with a specified overlap value
87
+ cloud_button("Short Text", color="1", overlap=20)
88
+ cloud_button("This is a longer piece of text", color="2", overlap=20)
89
+ cloud_button("This is an even longer piece of text to test the cloud button", color="3", overlap=20)
90
+
91
 
92
 
93
  def load_pdf(file_path):