Update app.py
Browse files
app.py
CHANGED
@@ -1,51 +1,30 @@
|
|
1 |
import streamlit as st
|
2 |
-
from PIL import Image, ImageDraw
|
3 |
-
import numpy as np
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
for area in clickable_areas:
|
34 |
-
x, y = area["coords"][:2]
|
35 |
-
draw.text((x, y), "*", fill="red")
|
36 |
-
|
37 |
-
# Display the image and get mouse click coordinates
|
38 |
-
st.image(image, caption="Uploaded Image with Clickable Areas", use_container_width=True)
|
39 |
-
|
40 |
-
# Simulate a click using Streamlit's interactive input
|
41 |
-
click_x = st.number_input("Click X coordinate:", min_value=0, max_value=image.width, value=0)
|
42 |
-
click_y = st.number_input("Click Y coordinate:", min_value=0, max_value=image.height, value=0)
|
43 |
-
|
44 |
-
# Check if the click is inside any defined area
|
45 |
-
clicked_area = check_click(click_x, click_y, clickable_areas)
|
46 |
-
|
47 |
-
if clicked_area:
|
48 |
-
st.write(f"You clicked on: {clicked_area}")
|
49 |
-
show_form(clicked_area)
|
50 |
-
else:
|
51 |
-
st.write("Click on a valid area to trigger an action.")
|
|
|
1 |
import streamlit as st
|
|
|
|
|
2 |
|
3 |
+
if st.button("Click me"):
|
4 |
+
st.write("Clicked")
|
5 |
+
|
6 |
+
st.markdown(
|
7 |
+
"""
|
8 |
+
<style>
|
9 |
+
button {
|
10 |
+
background: none!important;
|
11 |
+
border: none;
|
12 |
+
padding: 0!important;
|
13 |
+
color: black !important;
|
14 |
+
text-decoration: none;
|
15 |
+
cursor: pointer;
|
16 |
+
border: none !important;
|
17 |
+
}
|
18 |
+
button:hover {
|
19 |
+
text-decoration: none;
|
20 |
+
color: black !important;
|
21 |
+
}
|
22 |
+
button:focus {
|
23 |
+
outline: none !important;
|
24 |
+
box-shadow: none !important;
|
25 |
+
color: black !important;
|
26 |
+
}
|
27 |
+
</style>
|
28 |
+
""",
|
29 |
+
unsafe_allow_html=True,
|
30 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|