Spaces:
Runtime error
Runtime error
RebeccaNissan26
commited on
Commit
•
5833c9b
1
Parent(s):
22cc0de
try name hack
Browse files- app.py +6 -9
- numpy_files/1205045288117020016.npy +3 -0
- numpy_files/2399738000417381513.npy +3 -0
- numpy_files/3268948859446517114.npy +3 -0
- numpy_files/3517995218957041214.npy +3 -0
- numpy_files/4182340004986797719.npy +3 -0
- numpy_files/4617259572479165215.npy +3 -0
- numpy_files/5500775309238786210.npy +3 -0
- numpy_files/552609781892851211.npy +3 -0
- numpy_files/5663079497093130113.npy +3 -0
- numpy_files/9000307066571621514.npy +3 -0
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
|
@@ -72,17 +72,14 @@ if __name__ == "__main__":
|
|
72 |
with gr.Blocks(title="Contrail Predictions") as demo:
|
73 |
gr.Markdown("""<h1><center>Predict Contrails in Satellite Images</center></h1>""")
|
74 |
with gr.Row():
|
75 |
-
img_input = gr.Image(type="numpy", height=256, width=256, label="Input
|
76 |
-
file_input = gr.File()
|
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 |
-
|
84 |
-
|
85 |
-
examples = [[i for i in images_dir],[f for f in files_dir]]
|
86 |
-
gr.Examples(examples=examples, inputs=[img_input,file_input], outputs=img_output)
|
87 |
|
88 |
demo.launch()
|
|
|
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('numpy_files/' + str(ash_image) + '.npy')
|
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
|
|
|
72 |
with gr.Blocks(title="Contrail Predictions") as demo:
|
73 |
gr.Markdown("""<h1><center>Predict Contrails in Satellite Images</center></h1>""")
|
74 |
with gr.Row():
|
75 |
+
img_input = gr.Image(type="numpy", height=256, width=256, label="Image Input")
|
|
|
76 |
img_output = gr.AnnotatedImage(label="Predictions", height=256, width=256, color_map=class2hexcolor)
|
77 |
|
78 |
section_btn = gr.Button("Generate Predictions")
|
79 |
+
section_btn.click(partial(predict, model=model), img_input, img_output)
|
80 |
|
81 |
+
images_dir = glob(os.path.join(os.getcwd(), "images") + os.sep + "*.png")
|
82 |
+
examples = [i for i in images_dir]
|
83 |
+
gr.Examples(examples=examples, inputs=img_input, outputs=img_output)
|
|
|
|
|
84 |
|
85 |
demo.launch()
|
numpy_files/1205045288117020016.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ca4148f832c14f341cb30b8b2035b16dae252fef9e72408e53426f68d5b9fca9
|
3 |
+
size 786560
|
numpy_files/2399738000417381513.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dfd6328ab73de8a83ff9b074a1c88c17fdfea7f48ec09e8a7969a1f2682cc37c
|
3 |
+
size 786560
|
numpy_files/3268948859446517114.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4c8a551a1024b1fd7cbe6a0e5903ece6b4d7d365a2401ea9d27996e407be7e06
|
3 |
+
size 786560
|
numpy_files/3517995218957041214.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:da568f0b45293dbdd58f723cc3bbd052cea80f83d39e8ebc0acd4821d7fec0b3
|
3 |
+
size 786560
|
numpy_files/4182340004986797719.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:672c88df83c80e27edb7bc02e808d37198856f919ad3d887fc4fada31fe61323
|
3 |
+
size 786560
|
numpy_files/4617259572479165215.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1de15bfc4927e49f55e95e621b8928739eed7d109730b311fc294be91d3a098a
|
3 |
+
size 786560
|
numpy_files/5500775309238786210.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dcf49047e0c7c2877ca6d156c92b25e010966846c7aa517b77b5283984e96585
|
3 |
+
size 786560
|
numpy_files/552609781892851211.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:73dbf3560103b0f96c6948d511317e9eff8729f1f3eaceb0a2df12683b520121
|
3 |
+
size 786560
|
numpy_files/5663079497093130113.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:486290f6062e2f0f3f75527f75b7f7f7c3773ede656db804fbbf457450d43298
|
3 |
+
size 786560
|
numpy_files/9000307066571621514.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7597eb7a6c542a12376bd99f7da84737845c86ca5e73d71ecf411891ff9cbc21
|
3 |
+
size 786560
|