testdepth / app.py
ascarlettvfx's picture
Create app.py
304db7c verified
raw
history blame
784 Bytes
from transformers import pipeline
import gradio as gr
# Initialize the pipeline with the Marigold model hosted on Hugging Face
model = pipeline("image-to-image", model="prs-eth/marigold-depth-v1-0")
def predict_depth(image):
# Generate a depth map from the input image using the model
output = model(image)
return output['output_image'] # Ensure this key matches the output of your model
# Set up the Gradio interface
interface = gr.Interface(
fn=predict_depth,
inputs=gr.inputs.Image(shape=(512, 512), label="Upload Image"),
outputs=gr.outputs.Image(label="Depth Map"),
title="Marigold Depth Map Estimation",
description="Upload an image and the model will estimate and display its depth map."
)
if __name__ == "__main__":
interface.launch()