quantize_image / app.py
Dabs's picture
add n to quantize
4cb4ee2
raw
history blame
302 Bytes
import numpy as np
import gradio as gr
def quantize(val, n):
return (np.round(n * val / 255) * 255).astype(np.uint8)
def sepia(n, input_img):
output_img = [quantize(val, n) for val in input_img]
return output_img
iface = gr.Interface(sepia, ["number", "image"], "pil")
iface.launch()