Spaces:
Build error
Build error
Commit
·
f1ecf3e
1
Parent(s):
1b3d3da
updates
Browse files
app.py
CHANGED
|
@@ -77,17 +77,8 @@ def patch(ij):
|
|
| 77 |
imc=imm.crop(((x-1)*patch_size,(y-1)*patch_size,(x+2)*patch_size,(y+2)*patch_size))
|
| 78 |
return imc
|
| 79 |
|
| 80 |
-
if "sideimg" not in st.session_state:
|
| 81 |
-
st.session_state["sideimg"] = [patch(i) for i in range(4)]
|
| 82 |
-
|
| 83 |
-
if "sideix" not in st.session_state:
|
| 84 |
-
st.session_state["sideix"] = [i for i in range(4)]
|
| 85 |
-
|
| 86 |
-
def button_click():
|
| 87 |
-
st.session_state["img"]=np.random.randint(100)
|
| 88 |
-
st.session_state["draw"] = False
|
| 89 |
-
|
| 90 |
def find():
|
|
|
|
| 91 |
point=st.session_state["point"]
|
| 92 |
point=(point[0]//patch_size,point[1]//patch_size)
|
| 93 |
#point=point[0]*36+point[1]
|
|
@@ -103,8 +94,6 @@ def find():
|
|
| 103 |
batches=[]
|
| 104 |
while ix<4:
|
| 105 |
|
| 106 |
-
#for ix in range(4):
|
| 107 |
-
|
| 108 |
batch=diff.argsort()[i]//(gridsize**2)//20
|
| 109 |
|
| 110 |
if batch not in batches:
|
|
@@ -116,20 +105,18 @@ def find():
|
|
| 116 |
|
| 117 |
i+=1
|
| 118 |
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
#st.session_state["sideix"][ix]=diff.argsort()[ix]
|
| 123 |
-
|
| 124 |
-
#st.write(diff.argsort()[ix])
|
| 125 |
-
|
| 126 |
|
| 127 |
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
# st.image(ds[0]['image'])
|
| 132 |
|
|
|
|
|
|
|
| 133 |
|
| 134 |
def get_ellipse_coords(point):# tuple[int, int]) -> tuple[int, int, int, int]):
|
| 135 |
center = point
|
|
|
|
| 77 |
imc=imm.crop(((x-1)*patch_size,(y-1)*patch_size,(x+2)*patch_size,(y+2)*patch_size))
|
| 78 |
return imc
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
def find():
|
| 81 |
+
st.session_state["sideix"] = []
|
| 82 |
point=st.session_state["point"]
|
| 83 |
point=(point[0]//patch_size,point[1]//patch_size)
|
| 84 |
#point=point[0]*36+point[1]
|
|
|
|
| 94 |
batches=[]
|
| 95 |
while ix<4:
|
| 96 |
|
|
|
|
|
|
|
| 97 |
batch=diff.argsort()[i]//(gridsize**2)//20
|
| 98 |
|
| 99 |
if batch not in batches:
|
|
|
|
| 105 |
|
| 106 |
i+=1
|
| 107 |
|
| 108 |
+
st.session_state["sideix"]=batches
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
|
| 111 |
+
def button_click():
|
| 112 |
+
st.session_state["img"]=np.random.randint(100)
|
| 113 |
+
st.session_state["draw"] = False
|
| 114 |
|
| 115 |
+
if "sideimg" not in st.session_state:
|
| 116 |
+
st.session_state["sideimg"] = [patch(i) for i in range(4)]
|
|
|
|
| 117 |
|
| 118 |
+
if "sideix" not in st.session_state:
|
| 119 |
+
find()
|
| 120 |
|
| 121 |
def get_ellipse_coords(point):# tuple[int, int]) -> tuple[int, int, int, int]):
|
| 122 |
center = point
|