Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -141,7 +141,7 @@ if st.session_state.image is not None:
|
|
| 141 |
|
| 142 |
# predictions
|
| 143 |
if 'results' not in st.session_state:
|
| 144 |
-
st.
|
| 145 |
|
| 146 |
|
| 147 |
_, row4_col2, row4_col3, _ = st.columns([1,4,4,1], gap="medium")
|
|
@@ -155,11 +155,11 @@ if st.session_state.image is not None:
|
|
| 155 |
st.session_state.image_counter -= 1
|
| 156 |
with row4b_col3:
|
| 157 |
if st.button("Next"):
|
| 158 |
-
if st.session_state.image_counter < len(st.
|
| 159 |
st.session_state.image_counter += 1
|
| 160 |
|
| 161 |
# Plot predicted image
|
| 162 |
-
im_bgr = st.
|
| 163 |
im_rgb = Image.fromarray(im_bgr[..., ::-1]) # RGB-order PIL image
|
| 164 |
st.image(im_rgb)
|
| 165 |
|
|
|
|
| 141 |
|
| 142 |
# predictions
|
| 143 |
if 'results' not in st.session_state:
|
| 144 |
+
st.session_state.results = st.session_state.model.predict(tiles) # predict
|
| 145 |
|
| 146 |
|
| 147 |
_, row4_col2, row4_col3, _ = st.columns([1,4,4,1], gap="medium")
|
|
|
|
| 155 |
st.session_state.image_counter -= 1
|
| 156 |
with row4b_col3:
|
| 157 |
if st.button("Next"):
|
| 158 |
+
if st.session_state.image_counter < len(st.session_state.results):
|
| 159 |
st.session_state.image_counter += 1
|
| 160 |
|
| 161 |
# Plot predicted image
|
| 162 |
+
im_bgr = st.session_state.results[st.session_state.image_counter].plot() # BGR-order numpy array
|
| 163 |
im_rgb = Image.fromarray(im_bgr[..., ::-1]) # RGB-order PIL image
|
| 164 |
st.image(im_rgb)
|
| 165 |
|