Spaces:
Running
Running
import gradio as gr | |
from model import predict | |
color_maps = [ | |
'viridis', 'plasma', 'inferno', 'magma', 'cividis', | |
'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds', | |
'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu', | |
'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn', | |
'binary', 'gist_yarg', 'gist_gray', 'gray', 'bone', | |
'pink', 'spring', 'summer', 'autumn', 'winter', 'cool', | |
'Wistia', 'hot', 'afmhot', 'gist_heat', 'copper', | |
'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu', 'RdYlBu', | |
'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic', | |
'twilight', 'twilight_shifted', 'hsv', | |
'Pastel1', 'Pastel2', 'Paired', 'Accent', 'Dark2', | |
'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', 'tab20c', | |
'flag', 'prism', 'ocean', 'gist_earth', 'terrain', | |
'gist_stern', 'gnuplot', 'gnuplot2', 'CMRmap', | |
'cubehelix', 'brg', 'gist_rainbow', 'rainbow', 'jet', | |
'turbo', 'nipy_spectral', 'gist_ncar', | |
] | |
examples = [ | |
["assets/examples/myself.jpeg", "afmhot"], | |
["assets/examples/myself.jpeg", "inferno"], | |
] | |
interface = gr.Interface( | |
fn=predict, | |
inputs=[ | |
gr.Image(type="pil"), | |
gr.Dropdown(choices=color_maps), | |
], | |
outputs=gr.Image(type="pil"), | |
title="DepthPro: Colorify", | |
description="Applies segmentation on the input image, then creates the depth map and finally colorizes it.", | |
examples=examples, | |
) | |
if __name__ == "__main__": | |
interface.launch() | |