Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,8 +32,7 @@ def process_image(image):
|
|
| 32 |
# forward pass
|
| 33 |
with torch.no_grad():
|
| 34 |
outputs = model(**encoding)
|
| 35 |
-
|
| 36 |
-
predicted_depth = outputs.predicted_depth
|
| 37 |
|
| 38 |
# interpolate to original size
|
| 39 |
prediction = torch.nn.functional.interpolate(
|
|
@@ -55,16 +54,11 @@ title = "Interactive demo: DPT"
|
|
| 55 |
description = "Demo for Intel's DPT, a Dense Prediction Transformer for state-of-the-art dense prediction tasks such as semantic segmentation and depth estimation."
|
| 56 |
examples =[['cats.jpg']]
|
| 57 |
|
| 58 |
-
css = ".output-image, .input-image {height: 40rem !important; width: 100% !important;}"
|
| 59 |
-
#css = "@media screen and (max-width: 600px) { .output_image, .input_image {height:20rem !important; width: 100% !important;} }"
|
| 60 |
-
# css = ".output_image, .input_image {height: 600px !important}"
|
| 61 |
-
|
| 62 |
iface = gr.Interface(fn=process_image,
|
| 63 |
inputs=gr.inputs.Image(type="pil"),
|
| 64 |
outputs=gr.outputs.Image(type="pil", label="predicted depth"),
|
| 65 |
title=title,
|
| 66 |
description=description,
|
| 67 |
examples=examples,
|
| 68 |
-
css=css,
|
| 69 |
enable_queue=True)
|
| 70 |
iface.launch(debug=True)
|
|
|
|
| 32 |
# forward pass
|
| 33 |
with torch.no_grad():
|
| 34 |
outputs = model(**encoding)
|
| 35 |
+
predicted_depth = outputs.predicted_depth
|
|
|
|
| 36 |
|
| 37 |
# interpolate to original size
|
| 38 |
prediction = torch.nn.functional.interpolate(
|
|
|
|
| 54 |
description = "Demo for Intel's DPT, a Dense Prediction Transformer for state-of-the-art dense prediction tasks such as semantic segmentation and depth estimation."
|
| 55 |
examples =[['cats.jpg']]
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
iface = gr.Interface(fn=process_image,
|
| 58 |
inputs=gr.inputs.Image(type="pil"),
|
| 59 |
outputs=gr.outputs.Image(type="pil", label="predicted depth"),
|
| 60 |
title=title,
|
| 61 |
description=description,
|
| 62 |
examples=examples,
|
|
|
|
| 63 |
enable_queue=True)
|
| 64 |
iface.launch(debug=True)
|