Spaces:
Runtime error
Runtime error
Commit ·
22cc0de
1
Parent(s): e3652cf
attempt tuples
Browse files
app.py
CHANGED
|
@@ -55,7 +55,7 @@ model.compile(metrics=metrics)
|
|
| 55 |
def predict(ash_image, model=model):
|
| 56 |
#label = np.load(label_image)
|
| 57 |
# ash_image = np.load('images/552609781892851211.npy')
|
| 58 |
-
ash_image = np.load(ash_image)
|
| 59 |
y_pred = model.predict(ash_image.reshape(1,256, 256, 3))
|
| 60 |
prediction = np.argmax(y_pred[0], axis=2).reshape(256,256)
|
| 61 |
#intersection = label & prediction
|
|
@@ -77,7 +77,7 @@ if __name__ == "__main__":
|
|
| 77 |
img_output = gr.AnnotatedImage(label="Predictions", height=256, width=256, color_map=class2hexcolor)
|
| 78 |
|
| 79 |
section_btn = gr.Button("Generate Predictions")
|
| 80 |
-
section_btn.click(partial(predict, model=model),
|
| 81 |
|
| 82 |
images_dir = glob(os.path.join(os.getcwd(), "images") + os.sep + "*.png")
|
| 83 |
files_dir = glob(os.path.join(os.getcwd(), "numpy_files") + os.sep + "*.npy")
|
|
|
|
| 55 |
def predict(ash_image, model=model):
|
| 56 |
#label = np.load(label_image)
|
| 57 |
# ash_image = np.load('images/552609781892851211.npy')
|
| 58 |
+
ash_image = np.load(ash_image[1])
|
| 59 |
y_pred = model.predict(ash_image.reshape(1,256, 256, 3))
|
| 60 |
prediction = np.argmax(y_pred[0], axis=2).reshape(256,256)
|
| 61 |
#intersection = label & prediction
|
|
|
|
| 77 |
img_output = gr.AnnotatedImage(label="Predictions", height=256, width=256, color_map=class2hexcolor)
|
| 78 |
|
| 79 |
section_btn = gr.Button("Generate Predictions")
|
| 80 |
+
section_btn.click(partial(predict, model=model), [img_input,file_input], img_output)
|
| 81 |
|
| 82 |
images_dir = glob(os.path.join(os.getcwd(), "images") + os.sep + "*.png")
|
| 83 |
files_dir = glob(os.path.join(os.getcwd(), "numpy_files") + os.sep + "*.npy")
|