Spaces:
Sleeping
Sleeping
File size: 1,344 Bytes
2d57f1d 1491886 2d57f1d 1491886 8d419d7 1491886 2d57f1d 1491886 2d57f1d e7f42e5 2d57f1d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import gradio as gr
from gradio_client import Client, handle_file
def predict_depth(image):
client = Client("prs-eth/marigold")
try:
# Full parameter set assuming all are required
result = client.predict(
handle_file(image),
1, # Ensemble size
10, # Number of denoising steps
"0", # Processing resolution
handle_file('https://example.com/sample_file.pdf'), # Placeholder URL for required file inputs
handle_file('https://example.com/sample_file.pdf'),
handle_file('https://example.com/sample_file.pdf'),
0.5, # Relative near plane position
0.9, # Relative far plane position
10, # Embossing level
2, # Smoothing filter size
-50, # Near plane offset
api_name="/submit_depth_fn"
)
if result and result[0]:
return result[0]
except Exception as e:
return f"An error occurred: {str(e)}"
return "No depth output available"
# Gradio Interface
iface = gr.Interface(
fn=predict_depth,
inputs=gr.Image(type='filepath', label="Upload your image"),
outputs=gr.File(label="Download Depth Map"),
title="Depth Map Generator",
description="Upload an image to receive a depth map file."
)
iface.launch()
|