Circularmachines
commited on
Commit
•
3bc8e5f
1
Parent(s):
5dd047f
updates
Browse files
app.py
CHANGED
@@ -28,7 +28,8 @@ gridsize=31
|
|
28 |
n_patches=961
|
29 |
|
30 |
#pred=np.load('pred.npy')
|
31 |
-
|
|
|
32 |
|
33 |
random_i=np.load('random.npy')
|
34 |
|
@@ -42,6 +43,10 @@ if "img" not in st.session_state:
|
|
42 |
if "draw" not in st.session_state:
|
43 |
st.session_state["draw"] = True
|
44 |
|
|
|
|
|
|
|
|
|
45 |
def patch(ij):
|
46 |
#st.write(ij)
|
47 |
immg=ij//n_patches
|
@@ -65,7 +70,7 @@ def find():
|
|
65 |
#st.write(pred_all[st.session_state["img"],point[0]*36+point[1]])
|
66 |
i=st.session_state["img"]
|
67 |
p=point[1]*gridsize+point[0]
|
68 |
-
diff=np.linalg.norm(
|
69 |
#re_pred=pred_all.reshape(20,20,256,64)
|
70 |
#diff_re=diff.reshape((20,20,256)).argmin(axis=[])
|
71 |
i=0
|
@@ -144,6 +149,12 @@ with col1:
|
|
144 |
with scol1:
|
145 |
st.button('Change Image', on_click=button_click)
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
with scol2:
|
148 |
st.button('Find similar parts', on_click=find)
|
149 |
|
|
|
28 |
n_patches=961
|
29 |
|
30 |
#pred=np.load('pred.npy')
|
31 |
+
pred_dict=[np.load('pred_all_hue.npy').reshape(-1,64),np.load('pred_all_grey.npy').reshape(-1,64)]
|
32 |
+
#pred_all=np.load('pred_all.npy').reshape(-1,64)
|
33 |
|
34 |
random_i=np.load('random.npy')
|
35 |
|
|
|
43 |
if "draw" not in st.session_state:
|
44 |
st.session_state["draw"] = True
|
45 |
|
46 |
+
if "model" not in st.session_state:
|
47 |
+
st.session_state["model"] = pred_dict.keys()[0]
|
48 |
+
|
49 |
+
|
50 |
def patch(ij):
|
51 |
#st.write(ij)
|
52 |
immg=ij//n_patches
|
|
|
70 |
#st.write(pred_all[st.session_state["img"],point[0]*36+point[1]])
|
71 |
i=st.session_state["img"]
|
72 |
p=point[1]*gridsize+point[0]
|
73 |
+
diff=np.linalg.norm(pred_dict[st.session_state["model"]][np.newaxis,i*n_patches+p,:]-pred_dict[st.session_state["model"]],axis=-1)
|
74 |
#re_pred=pred_all.reshape(20,20,256,64)
|
75 |
#diff_re=diff.reshape((20,20,256)).argmin(axis=[])
|
76 |
i=0
|
|
|
149 |
with scol1:
|
150 |
st.button('Change Image', on_click=button_click)
|
151 |
|
152 |
+
st.session_state["model"] = st.selectbox(
|
153 |
+
'Model',
|
154 |
+
pred_dict.keys())
|
155 |
+
|
156 |
+
st.write('You selected:', option)
|
157 |
+
|
158 |
with scol2:
|
159 |
st.button('Find similar parts', on_click=find)
|
160 |
|