Commit
·
faf8b4b
1
Parent(s):
3df94f0
app.py updates
Browse files
app.py
CHANGED
@@ -22,8 +22,8 @@ ds = load_dataset("Circularmachines/batch_indexing_machine_100_small_imgs", spli
|
|
22 |
|
23 |
#"# :dart: Streamlit Image Coordinates: Image Update"
|
24 |
|
25 |
-
if "
|
26 |
-
st.session_state["
|
27 |
|
28 |
if "img" not in st.session_state:
|
29 |
st.session_state["img"] = 0
|
@@ -39,8 +39,13 @@ def button_click():
|
|
39 |
st.session_state["draw"] = False
|
40 |
|
41 |
def find():
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
44 |
# st.image(ds[0]['image'])
|
45 |
|
46 |
|
@@ -66,26 +71,28 @@ with col1:
|
|
66 |
|
67 |
# Draw an ellipse at each coordinate in points
|
68 |
#for point in st.session_state["points"]:
|
69 |
-
point=st.session_state["
|
70 |
coords = get_ellipse_coords(point)
|
71 |
draw.rectangle(coords, outline="green",width=2)
|
72 |
|
73 |
value = streamlit_image_coordinates(current_image, key="pil")
|
74 |
|
75 |
if value is not None:
|
76 |
-
point = value["x"], value["y"]
|
77 |
|
78 |
-
if point != st.session_state["
|
79 |
-
st.session_state["
|
80 |
st.session_state["draw"]=True
|
81 |
st.experimental_rerun()
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
86 |
|
87 |
st.write(st.session_state["img"])
|
88 |
-
st.write(st.session_state["
|
89 |
st.write(st.session_state["draw"])
|
90 |
|
91 |
with col2:
|
|
|
22 |
|
23 |
#"# :dart: Streamlit Image Coordinates: Image Update"
|
24 |
|
25 |
+
if "point" not in st.session_state:
|
26 |
+
st.session_state["point"] = (200,200)
|
27 |
|
28 |
if "img" not in st.session_state:
|
29 |
st.session_state["img"] = 0
|
|
|
39 |
st.session_state["draw"] = False
|
40 |
|
41 |
def find():
|
42 |
+
point=st.session_state["point"]
|
43 |
+
st.write()
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
# for i in range(4):
|
48 |
+
# st.session_state["sideimg"][i]+=1
|
49 |
# st.image(ds[0]['image'])
|
50 |
|
51 |
|
|
|
71 |
|
72 |
# Draw an ellipse at each coordinate in points
|
73 |
#for point in st.session_state["points"]:
|
74 |
+
point=st.session_state["point"]
|
75 |
coords = get_ellipse_coords(point)
|
76 |
draw.rectangle(coords, outline="green",width=2)
|
77 |
|
78 |
value = streamlit_image_coordinates(current_image, key="pil")
|
79 |
|
80 |
if value is not None:
|
81 |
+
point = value["x"]//32*32, value["y"]//32*32
|
82 |
|
83 |
+
if point != st.session_state["point"]:
|
84 |
+
st.session_state["point"]=point
|
85 |
st.session_state["draw"]=True
|
86 |
st.experimental_rerun()
|
87 |
|
88 |
+
subcol1, subcol2 = st.columns(3)
|
89 |
+
with subcol1:
|
90 |
+
st.button('Previous Frame', on_click=button_click)
|
91 |
+
st.button('Change Batch', on_click=button_click)
|
92 |
+
st.button('Find similar parts', on_click=find)
|
93 |
|
94 |
st.write(st.session_state["img"])
|
95 |
+
st.write(st.session_state["point"])
|
96 |
st.write(st.session_state["draw"])
|
97 |
|
98 |
with col2:
|
pred.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9c7dd00bca5acaa98f0b6c16c73eec0c6830d3643d2a273fa90c5ee64b26c1a2
|
3 |
+
size 30924928
|