gitio-image-filter / demo.yaml
lint's picture
Upload folder using huggingface_hub
8585771
lite_metadata:
gradio_version: 3.36.1
liteobj_version: 0.0.7
class_string: gradio.interface.Interface
kwargs:
title: Gradio Webapp
description: Given a pil image, apply a sepia filter
article: null
thumbnail: null
theme: gradio/seafoam
css: null
allow_flagging: never
inputs:
- class_string: gradio.components.image.Image
kwargs:
label: image
type: pil
outputs:
- class_string: gradio.components.image.Image
kwargs:
label: output
type: pil
fn:
class_string: gradify.closure
kwargs:
argmaps:
- label: image
postprocessing: null
func_kwargs: {}
source: "from PIL import Image\n\ndef apply_sepia_filter(image):\n width,\
\ height = image.size\n pixels = image.load()\n for i in range(width):\n\
\ for j in range(height):\n r, g, b = pixels[i, j]\n \
\ tr = int(0.393 * r + 0.769 * g + 0.189 * b)\n tg = int(0.349\
\ * r + 0.686 * g + 0.168 * b)\n tb = int(0.272 * r + 0.534 * g\
\ + 0.131 * b)\n pixels[i, j] = (min(tr, 255), min(tg, 255), min(tb,\
\ 255))\n return image\nimage = Image.open('input_image.jpg')\nsepia_image\
\ = apply_sepia_filter(image)\nsepia_image.show()"