Update app.py
Browse files
app.py
CHANGED
@@ -1,48 +1,4 @@
|
|
1 |
-
|
2 |
-
from PIL import Image
|
3 |
|
4 |
-
|
5 |
-
st.
|
6 |
-
|
7 |
-
# Load the image
|
8 |
-
image_path = "test.png"
|
9 |
-
image = Image.open(image_path)
|
10 |
-
|
11 |
-
# Display the image
|
12 |
-
st.image(image, caption="Interactive Image", use_column_width=True)
|
13 |
-
|
14 |
-
# Create a clickable area
|
15 |
-
st.markdown("""
|
16 |
-
<style>
|
17 |
-
.clickable {
|
18 |
-
position: absolute;
|
19 |
-
top: 20%; /* Adjust position to where text should appear on the image */
|
20 |
-
left: 50%; /* Adjust position to where text should appear on the image */
|
21 |
-
transform: translate(-50%, -50%);
|
22 |
-
color: white;
|
23 |
-
font-size: 24px;
|
24 |
-
font-weight: bold;
|
25 |
-
background: rgba(0, 0, 0, 0.5);
|
26 |
-
padding: 10px 20px;
|
27 |
-
border-radius: 5px;
|
28 |
-
cursor: pointer;
|
29 |
-
z-index: 2;
|
30 |
-
}
|
31 |
-
</style>
|
32 |
-
<div class="clickable" onClick="window.open('#form', '_self')">
|
33 |
-
Click me
|
34 |
-
</div>
|
35 |
-
""", unsafe_allow_html=True)
|
36 |
-
|
37 |
-
# Anchor for form
|
38 |
-
st.markdown('<a name="form"></a>', unsafe_allow_html=True)
|
39 |
-
|
40 |
-
# If clicked, show a form
|
41 |
-
if st.button("Click me"):
|
42 |
-
with st.form("form", clear_on_submit=True):
|
43 |
-
st.write("Fill out this form:")
|
44 |
-
name = st.text_input("Name")
|
45 |
-
email = st.text_input("Email")
|
46 |
-
submitted = st.form_submit_button("Submit")
|
47 |
-
if submitted:
|
48 |
-
st.success(f"Form submitted! Name: {name}, Email: {email}")
|
|
|
1 |
+
st.write("<a href='#' id='my-link'>Click me</a>", unsafe_allow_html=True)
|
|
|
2 |
|
3 |
+
if st.button("my-link"):
|
4 |
+
st.write("Link clicked!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|