Update app.py
Browse files
app.py
CHANGED
@@ -1,30 +1,43 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
|
4 |
-
|
|
|
5 |
|
|
|
6 |
st.markdown(
|
7 |
-
"""
|
8 |
<style>
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
background: none!important;
|
11 |
border: none;
|
12 |
-
|
13 |
-
color: black !important;
|
14 |
text-decoration: none;
|
15 |
cursor: pointer;
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
19 |
text-decoration: none;
|
20 |
-
color: black
|
21 |
-
|
22 |
-
|
23 |
-
outline: none !important;
|
24 |
-
box-shadow: none !important;
|
25 |
-
color: black !important;
|
26 |
-
}
|
27 |
</style>
|
|
|
|
|
|
|
|
|
28 |
""",
|
29 |
unsafe_allow_html=True,
|
30 |
-
)
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
# Load the image
|
4 |
+
image_path = "test.png"
|
5 |
+
image_url = f"data:image/png;base64,{st.file_uploader(image_path, type='png')}"
|
6 |
|
7 |
+
# HTML and CSS for the button overlaid on the image
|
8 |
st.markdown(
|
9 |
+
f"""
|
10 |
<style>
|
11 |
+
.image-container {{
|
12 |
+
position: relative;
|
13 |
+
width: fit-content;
|
14 |
+
}}
|
15 |
+
.image {{
|
16 |
+
display: block;
|
17 |
+
}}
|
18 |
+
.button {{
|
19 |
+
position: absolute;
|
20 |
+
top: 50%; /* Adjust to place the button */
|
21 |
+
left: 50%; /* Adjust to place the button */
|
22 |
+
transform: translate(-50%, -50%);
|
23 |
background: none!important;
|
24 |
border: none;
|
25 |
+
color: black;
|
|
|
26 |
text-decoration: none;
|
27 |
cursor: pointer;
|
28 |
+
font-size: 20px;
|
29 |
+
padding: 10px 20px;
|
30 |
+
}}
|
31 |
+
.button:hover {{
|
32 |
text-decoration: none;
|
33 |
+
color: black;
|
34 |
+
background: rgba(255, 255, 255, 0.5);
|
35 |
+
}}
|
|
|
|
|
|
|
|
|
36 |
</style>
|
37 |
+
<div class="image-container">
|
38 |
+
<img class="image" src="{image_url}" alt="Image with clickable button">
|
39 |
+
<button class="button" onclick="window.alert('Button clicked!');">Click Me</button>
|
40 |
+
</div>
|
41 |
""",
|
42 |
unsafe_allow_html=True,
|
43 |
+
)
|