Update app.py
Browse files
app.py
CHANGED
|
@@ -15,9 +15,10 @@ model = load_model("CADET.hdf5")
|
|
| 15 |
|
| 16 |
# Define function to plot the uploaded image
|
| 17 |
def plot_image(image_array, scale):
|
| 18 |
-
|
|
|
|
| 19 |
# plt.subplot(1, 2, 1)
|
| 20 |
-
x0 = image_array.shape[0] // 2
|
| 21 |
plt.imshow(image_array, origin="lower")
|
| 22 |
plt.gca().add_patch(Rectangle((x0, x0), scale*128, scale*128, linewidth=1, edgecolor='w', facecolor='none'))
|
| 23 |
plt.axis('off')
|
|
@@ -25,7 +26,8 @@ def plot_image(image_array, scale):
|
|
| 25 |
|
| 26 |
# Define function to plot the prediction
|
| 27 |
def plot_prediction(image_array, pred):
|
| 28 |
-
|
|
|
|
| 29 |
plt.subplot(1, 2, 1)
|
| 30 |
plt.imshow(image_array, origin="lower")
|
| 31 |
plt.axis('off')
|
|
|
|
| 15 |
|
| 16 |
# Define function to plot the uploaded image
|
| 17 |
def plot_image(image_array, scale):
|
| 18 |
+
st.set_plot_config(plt, figsize=(4, 4))
|
| 19 |
+
plt.figure(figsize=(4, 4))
|
| 20 |
# plt.subplot(1, 2, 1)
|
| 21 |
+
x0 = image_array.shape[0] // 2 - scale * 128 / 64
|
| 22 |
plt.imshow(image_array, origin="lower")
|
| 23 |
plt.gca().add_patch(Rectangle((x0, x0), scale*128, scale*128, linewidth=1, edgecolor='w', facecolor='none'))
|
| 24 |
plt.axis('off')
|
|
|
|
| 26 |
|
| 27 |
# Define function to plot the prediction
|
| 28 |
def plot_prediction(image_array, pred):
|
| 29 |
+
st.set_plot_config(plt, figsize=(8, 4))
|
| 30 |
+
plt.figure(figsize=(8, 4))
|
| 31 |
plt.subplot(1, 2, 1)
|
| 32 |
plt.imshow(image_array, origin="lower")
|
| 33 |
plt.axis('off')
|