Spaces:
Sleeping
Sleeping
Mehmet Batuhan Duman
commited on
Commit
·
36cfc7e
1
Parent(s):
f3ca93c
Changes on scan
Browse files
app.py
CHANGED
@@ -160,6 +160,12 @@ def scanmap(satellite_image, model):
|
|
160 |
|
161 |
|
162 |
def gradio_process_image(input_image):
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
image_np = np.array(input_image.convert("RGB"))
|
164 |
heatmap = scanmap(image_np, model)
|
165 |
heatmap_normalized = (heatmap - np.min(heatmap)) / (np.max(heatmap) - np.min(heatmap))
|
@@ -174,4 +180,4 @@ outputs = [
|
|
174 |
]
|
175 |
|
176 |
iface = gr.Interface(fn=gradio_process_image, inputs=inputs, outputs=outputs)
|
177 |
-
iface.launch()
|
|
|
160 |
|
161 |
|
162 |
def gradio_process_image(input_image):
|
163 |
+
if input_image is None:
|
164 |
+
return None, None
|
165 |
+
|
166 |
+
if isinstance(input_image, np.ndarray):
|
167 |
+
input_image = Image.fromarray(input_image)
|
168 |
+
|
169 |
image_np = np.array(input_image.convert("RGB"))
|
170 |
heatmap = scanmap(image_np, model)
|
171 |
heatmap_normalized = (heatmap - np.min(heatmap)) / (np.max(heatmap) - np.min(heatmap))
|
|
|
180 |
]
|
181 |
|
182 |
iface = gr.Interface(fn=gradio_process_image, inputs=inputs, outputs=outputs)
|
183 |
+
iface.launch(share=True)
|