Mehmet Batuhan Duman commited on
Commit
f6c66e9
1 Parent(s): f746c21

Changed scan func

Browse files
Files changed (2) hide show
  1. .idea/workspace.xml +1 -1
  2. app.py +7 -1
.idea/workspace.xml CHANGED
@@ -65,7 +65,7 @@
65
  <workItem from="1683665300392" duration="7649000" />
66
  <workItem from="1683708398011" duration="1235000" />
67
  <workItem from="1684437905081" duration="110000" />
68
- <workItem from="1686602174110" duration="3352000" />
69
  </task>
70
  <servers />
71
  </component>
 
65
  <workItem from="1683665300392" duration="7649000" />
66
  <workItem from="1683708398011" duration="1235000" />
67
  <workItem from="1684437905081" duration="110000" />
68
+ <workItem from="1686602174110" duration="3739000" />
69
  </task>
70
  <servers />
71
  </component>
app.py CHANGED
@@ -234,7 +234,13 @@ def process_image(input_image, model, threshold=0.5):
234
  def gradio_process_image(input_image, model, threshold=0.5):
235
  ship_images, elapsed_time = process_image(input_image, model, threshold)
236
 
237
- return ship_images, f"Elapsed Time (seconds): {elapsed_time}"
 
 
 
 
 
 
238
 
239
 
240
  inputs = gr.Image(label="Upload Image")
 
234
  def gradio_process_image(input_image, model, threshold=0.5):
235
  ship_images, elapsed_time = process_image(input_image, model, threshold)
236
 
237
+ if len(ship_images) > 0:
238
+ # Convert first image to format compatible with Gradio
239
+ output_image = Image.fromarray((ship_images[0] * 255).astype(np.uint8))
240
+ else:
241
+ output_image = None
242
+
243
+ return output_image, f"Elapsed Time (seconds): {elapsed_time}"
244
 
245
 
246
  inputs = gr.Image(label="Upload Image")