artelabsuper commited on
Commit
f5085fa
·
1 Parent(s): b4eade4

raw output

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -6,7 +6,6 @@ from models.model import GLPDepth
6
  from PIL import Image
7
  from torchvision import transforms
8
  import matplotlib.pyplot as plt
9
- from matplotlib.backends.backend_agg import FigureCanvasAgg
10
  import numpy as np
11
 
12
 
@@ -48,16 +47,19 @@ def predict(input_image):
48
  data = np.frombuffer(fig.canvas.tostring_rgb(), dtype=np.uint8)
49
  data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
50
 
51
- return data
52
 
53
  iface = gr.Interface(
54
  fn=predict,
55
  inputs=gr.Image(shape=(512,512)),
56
- outputs=gr.Image(shape=(512,512)),
 
 
 
57
  examples=[
58
  ["demo_imgs/fake.jpg"] # use real image
59
  ],
60
  title="DTM Estimation",
61
- description="This demo predict a DTM..."
62
  )
63
  iface.launch()
 
6
  from PIL import Image
7
  from torchvision import transforms
8
  import matplotlib.pyplot as plt
 
9
  import numpy as np
10
 
11
 
 
47
  data = np.frombuffer(fig.canvas.tostring_rgb(), dtype=np.uint8)
48
  data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
49
 
50
+ return data, str(predicted_image.tolist())
51
 
52
  iface = gr.Interface(
53
  fn=predict,
54
  inputs=gr.Image(shape=(512,512)),
55
+ outputs=[
56
+ gr.Image(shape=(512,512)),
57
+ gr.outputs.Textbox(label='Raw output')
58
+ ],
59
  examples=[
60
  ["demo_imgs/fake.jpg"] # use real image
61
  ],
62
  title="DTM Estimation",
63
+ description="This demo predict a DTM using GLP Depth model. It will scale input image to 512x512 and at the end it will apply a colormap to better visualize the output."
64
  )
65
  iface.launch()