Spaces:
Build error
Build error
Commit
·
854f030
1
Parent(s):
694c442
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,18 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
+
with Image.open("kitty.jpeg") as img:
|
| 4 |
+
draw = ImageDraw.Draw(img)
|
| 5 |
+
|
| 6 |
+
# Draw an ellipse at each coordinate in points
|
| 7 |
+
for point in st.session_state["points"]:
|
| 8 |
+
coords = get_ellipse_coords(point)
|
| 9 |
+
draw.ellipse(coords, fill="red")
|
| 10 |
+
|
| 11 |
+
value = streamlit_image_coordinates(img, key="pil")
|
| 12 |
+
|
| 13 |
+
if value is not None:
|
| 14 |
+
point = value["x"], value["y"]
|
| 15 |
+
|
| 16 |
+
if point not in st.session_state["points"]:
|
| 17 |
+
st.session_state["points"].append(point)
|
| 18 |
+
st.experimental_rerun()
|