Kazeo57 commited on
Commit
3781048
·
verified ·
1 Parent(s): 1be195d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -1,12 +1,17 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
2
 
3
- def greet(image):
4
- return image
5
-
6
- image_input=gr.Image(label="Upload your image")
7
  image_output=gr.Image(label="Image processed")
8
- iface=gr.Interface(fn=greet,inputs=image_input,
9
  outputs=image_output,title="FindSkinLesion",
10
  description="An app to make a segmentation on image in input to predict if there is a skin lesion or not")
11
 
12
- iface.launch()
 
1
  import gradio as gr
2
+ from skimage.filters import threshold_otsu
3
+ from PIL import Image
4
+ import numpy as np
5
+ def segmentor(image):
6
+ img_np=np.array(image.convert("L"))
7
+ threshold=threshold_otsu(img_np)
8
+ binary=img_np>threshold
9
+ return Image.fromarray(binary)
10
 
11
+ image_input=gr.Image(type="pil",label="Upload your image")
 
 
 
12
  image_output=gr.Image(label="Image processed")
13
+ iface=gr.Interface(fn=segmentor,inputs=image_input,
14
  outputs=image_output,title="FindSkinLesion",
15
  description="An app to make a segmentation on image in input to predict if there is a skin lesion or not")
16
 
17
+ iface.launch(share=True)