Spaces:
Build error
Build error
Commit
·
391663d
1
Parent(s):
186e7ec
app.py updates
Browse files
app.py
CHANGED
|
@@ -31,24 +31,15 @@ if "img" not in st.session_state:
|
|
| 31 |
if "draw" not in st.session_state:
|
| 32 |
st.session_state["draw"] = False
|
| 33 |
|
| 34 |
-
#"## Click on image"
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
r=0#np.random.randint(100)
|
| 38 |
-
current_image=ds[st.session_state["img"]]['image']
|
| 39 |
|
| 40 |
def button_click():
|
| 41 |
st.session_state["img"]=np.random.randint(100)
|
| 42 |
-
current_image=ds[r]['image']
|
| 43 |
#st.write(str(r))
|
| 44 |
-
st.session_state["points"] = [
|
| 45 |
#value = streamlit_image_coordinates(current_image, key="pil")
|
| 46 |
st.session_state["draw"]=False
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
draw = ImageDraw.Draw(current_image)
|
| 51 |
-
|
| 52 |
def get_ellipse_coords(point):# tuple[int, int]) -> tuple[int, int, int, int]):
|
| 53 |
center = point
|
| 54 |
radius = 16
|
|
@@ -60,6 +51,9 @@ def get_ellipse_coords(point):# tuple[int, int]) -> tuple[int, int, int, int]):
|
|
| 60 |
)
|
| 61 |
|
| 62 |
|
|
|
|
|
|
|
|
|
|
| 63 |
if st.session_state["draw"]:
|
| 64 |
|
| 65 |
# Draw an ellipse at each coordinate in points
|
|
|
|
| 31 |
if "draw" not in st.session_state:
|
| 32 |
st.session_state["draw"] = False
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
def button_click():
|
| 36 |
st.session_state["img"]=np.random.randint(100)
|
| 37 |
+
#current_image=ds[r]['image']
|
| 38 |
#st.write(str(r))
|
| 39 |
+
st.session_state["points"] = []
|
| 40 |
#value = streamlit_image_coordinates(current_image, key="pil")
|
| 41 |
st.session_state["draw"]=False
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
def get_ellipse_coords(point):# tuple[int, int]) -> tuple[int, int, int, int]):
|
| 44 |
center = point
|
| 45 |
radius = 16
|
|
|
|
| 51 |
)
|
| 52 |
|
| 53 |
|
| 54 |
+
current_image=ds[st.session_state["img"]]['image']
|
| 55 |
+
draw = ImageDraw.Draw(current_image)
|
| 56 |
+
|
| 57 |
if st.session_state["draw"]:
|
| 58 |
|
| 59 |
# Draw an ellipse at each coordinate in points
|