testapi / app.py
ascarlettvfx's picture
Update app.py
8d419d7 verified
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()