From 6d606f3092e1ce8bd76c8f6b73f2a4c01ae30e02 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 20 Sep 2021 07:32:39 -0500 Subject: [PATCH] updated sepia filter --- demo/sepia_filter.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/demo/sepia_filter.py b/demo/sepia_filter.py index 501b914eab..f941f4c812 100644 --- a/demo/sepia_filter.py +++ b/demo/sepia_filter.py @@ -1,14 +1,27 @@ import gradio as gr import numpy as np -def sepia(img): +def sepia(input_img): sepia_filter = np.array([[.393, .769, .189], [.349, .686, .168], [.272, .534, .131]]) - sepia_img = img.dot(sepia_filter.T) + sepia_img = input_img.dot(sepia_filter.T) sepia_img /= sepia_img.max() return sepia_img -iface = gr.Interface(sepia, gr.inputs.Image(shape=(200, 200)), "image") +iface = gr.Interface(sepia, gr.inputs.Image(shape=(200, 200)), "image", + article= +""" +This simple image demo returns applies a sepia filter to the input image, as described below: +```python +sepia_filter = np.array([[.393, .769, .189], + [.349, .686, .168], + [.272, .534, .131]]) +sepia_img = input_img.dot(sepia_filter.T) +sepia_img /= sepia_img.max() +``` +""" +) + if __name__ == "__main__": iface.launch() \ No newline at end of file