Commit
·
beb3e34
1
Parent(s):
6348e54
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,22 @@
|
|
1 |
import streamlit as st
|
2 |
-
from PIL import Image
|
3 |
|
4 |
from streamlit_image_coordinates import streamlit_image_coordinates
|
5 |
|
6 |
with Image.open("kitty.jpeg") as img:
|
7 |
draw = ImageDraw.Draw(img)
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# Draw an ellipse at each coordinate in points
|
10 |
for point in st.session_state["points"]:
|
11 |
coords = get_ellipse_coords(point)
|
|
|
1 |
import streamlit as st
|
2 |
+
from PIL import Image, ImageDraw
|
3 |
|
4 |
from streamlit_image_coordinates import streamlit_image_coordinates
|
5 |
|
6 |
with Image.open("kitty.jpeg") as img:
|
7 |
draw = ImageDraw.Draw(img)
|
8 |
|
9 |
+
def get_ellipse_coords(point: tuple[int, int]) -> tuple[int, int, int, int]:
|
10 |
+
center = point
|
11 |
+
radius = 10
|
12 |
+
return (
|
13 |
+
center[0] - radius,
|
14 |
+
center[1] - radius,
|
15 |
+
center[0] + radius,
|
16 |
+
center[1] + radius,
|
17 |
+
)
|
18 |
+
|
19 |
+
|
20 |
# Draw an ellipse at each coordinate in points
|
21 |
for point in st.session_state["points"]:
|
22 |
coords = get_ellipse_coords(point)
|