dbuscombe commited on
Commit
80ad4d4
1 Parent(s): 1374ff7
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -104,9 +104,9 @@ def segment(input_img, dims=(1024, 1024)):
104
  pred = resize(pred, (w, h), preserve_range=True, clip=True)
105
 
106
  bias=.1
107
- thres_land = threshold_otsu(pred[:,:,1])-bias
108
- print("Coin threshold: %f" % (thres_land))
109
- mask = (pred[:,:,1]<=thres_land).astype('uint8')
110
 
111
  imsave("greyscale.png", mask*255)
112
 
@@ -168,12 +168,11 @@ title = "Find and measure coins in images of sand!"
168
  description = "This model demonstration segments beach sediment imagery into two classes: a) background, and b) coin, then measuring the coin. Allows upload of imagery and download of label imagery only one at a time. This model is part of the Doodleverse https://github.com/Doodleverse"
169
 
170
 
171
- examples = [['examples/20191011_091052.jpg'],
172
- ['examples/20191010_135020.jpg'],
173
  ['examples/IMG_20210922_170908944.jpg'],
174
- ['examples/IMG_20211121_120533257_HDR.jpg'],
175
  ['examples/20210208_172834.jpg'],
176
- ['examples/20220101_165359.jpg']]
 
177
 
178
  inp = gr.Image()
179
  out1 = gr.Image(type='numpy')
 
104
  pred = resize(pred, (w, h), preserve_range=True, clip=True)
105
 
106
  bias=.1
107
+ thres_coin = threshold_otsu(pred[:,:,1])-bias
108
+ print("Coin threshold: %f" % (thres_coin))
109
+ mask = (pred[:,:,1]<=thres_coin).astype('uint8')
110
 
111
  imsave("greyscale.png", mask*255)
112
 
 
168
  description = "This model demonstration segments beach sediment imagery into two classes: a) background, and b) coin, then measuring the coin. Allows upload of imagery and download of label imagery only one at a time. This model is part of the Doodleverse https://github.com/Doodleverse"
169
 
170
 
171
+ examples = [
 
172
  ['examples/IMG_20210922_170908944.jpg'],
 
173
  ['examples/20210208_172834.jpg'],
174
+ ['examples/20220101_165359.jpg']
175
+ ]
176
 
177
  inp = gr.Image()
178
  out1 = gr.Image(type='numpy')