ebgoldstein commited on
Commit
0e9696b
·
1 Parent(s): 5b1acab
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -49,6 +49,8 @@ def FRFsegment(input_img):
49
 
50
  mask = np.argmax(np.squeeze(est_label, axis=0),-1)
51
  pred = resize(mask, (w, h), preserve_range=True, clip=True)
 
 
52
 
53
  #overlay plot
54
  plt.clf()
@@ -56,11 +58,11 @@ def FRFsegment(input_img):
56
  plt.imshow(pred, alpha=0.4)
57
  plt.axis("off")
58
  plt.margins(x=0, y=0)
59
- return plt
60
 
61
 
62
  title = "Segment beach imagery taken from a tower in Duck, NC, USA"
63
  description = "This model segments beach imagery into 4 classes: vegetation, sand, coarse sand, and background (water + sky + buildings + people)"
64
  examples = [['examples/FRF_c1_snap_20191112160000.jpg'], ['examples/FRF_c1_snap_20170101.jpg']]
65
 
66
- FRFSegapp = gr.Interface(FRFsegment, gr.inputs.Image(), "image", examples=examples, title = title, description = description).launch()
 
49
 
50
  mask = np.argmax(np.squeeze(est_label, axis=0),-1)
51
  pred = resize(mask, (w, h), preserve_range=True, clip=True)
52
+
53
+ imsave("label.png", pred)
54
 
55
  #overlay plot
56
  plt.clf()
 
58
  plt.imshow(pred, alpha=0.4)
59
  plt.axis("off")
60
  plt.margins(x=0, y=0)
61
+ return plt, "label.png"
62
 
63
 
64
  title = "Segment beach imagery taken from a tower in Duck, NC, USA"
65
  description = "This model segments beach imagery into 4 classes: vegetation, sand, coarse sand, and background (water + sky + buildings + people)"
66
  examples = [['examples/FRF_c1_snap_20191112160000.jpg'], ['examples/FRF_c1_snap_20170101.jpg']]
67
 
68
+ FRFSegapp = gr.Interface(FRFsegment, gr.inputs.Image(), ["image",gr.outputs.File()], examples=examples, title = title, description = description).launch()