Spaces:
Runtime error
Runtime error
| import numpy as np | |
| import gradio as gr | |
| def quantize(val, factor): | |
| quantized = (np.round(factor * np.array(val / 255)) * (255 / factor)).astype(int) | |
| # print(val / 255, factor, factor * np.array(val / 255)) | |
| return quantized | |
| def sepia(factor, input_img): | |
| output_img = [quantize(np.array(val), factor) for val in input_img] | |
| return output_img | |
| iface = gr.Interface(sepia, [gr.inputs.Slider(1, 10, 1), "image"], "pil") | |
| iface.launch() |