Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,9 @@ depth_estimator = pipeline(task="depth-estimation", model="Intel/dpt-hybrid-mida
|
|
| 11 |
# Function to process the image and return depth map
|
| 12 |
def launch(input_image):
|
| 13 |
try:
|
|
|
|
|
|
|
|
|
|
| 14 |
# Ensure the input image is in RGB mode
|
| 15 |
if input_image.mode != "RGB":
|
| 16 |
print(f"Converting image from {input_image.mode} to RGB.")
|
|
@@ -51,6 +54,7 @@ def launch(input_image):
|
|
| 51 |
return "An error occurred while processing the image."
|
| 52 |
|
| 53 |
|
|
|
|
| 54 |
# Define the Gradio interface
|
| 55 |
iface = gr.Interface(
|
| 56 |
fn=launch,
|
|
|
|
| 11 |
# Function to process the image and return depth map
|
| 12 |
def launch(input_image):
|
| 13 |
try:
|
| 14 |
+
# Resize the image to a fixed size (e.g., 640x480)
|
| 15 |
+
input_image = input_image.resize((640, 480))
|
| 16 |
+
|
| 17 |
# Ensure the input image is in RGB mode
|
| 18 |
if input_image.mode != "RGB":
|
| 19 |
print(f"Converting image from {input_image.mode} to RGB.")
|
|
|
|
| 54 |
return "An error occurred while processing the image."
|
| 55 |
|
| 56 |
|
| 57 |
+
|
| 58 |
# Define the Gradio interface
|
| 59 |
iface = gr.Interface(
|
| 60 |
fn=launch,
|