import gradio as gr def invert(img): return 255 - img iface = gr.Interface(fn=invert, inputs=gr.Image(type="numpy"), outputs=gr.Image()) iface.launch()