gitio-image-filter / demo.yaml
lint's picture
Upload folder using huggingface_hub
934eae2
raw
history blame
1.28 kB
lite_metadata:
gradio_version: 3.32.0
liteobj_version: 0.0.7
class_string: gradio.interface.Interface
kwargs:
title: gitio image filter
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
kwargs:
label: image
type: pil
outputs:
- class_string: gradio.components.Image
kwargs:
label: output
type: pil
fn:
class_string: gradify.gradify_closure
kwargs:
argmaps:
- label: image
postprocessing: null
func_kwargs: {}
ldict:
class_string: gradify.exec_to_dict
kwargs:
source: "from PIL import Image\n\n\ndef apply_sepia_filter(image):\n \
\ width, height = image.size\n for x in range(width):\n for\
\ y in range(height):\n r, g, b = image.getpixel((x, y))\n\
\ new_r = int(r * 0.393 + g * 0.769 + b * 0.189)\n \
\ new_g = int(r * 0.349 + g * 0.686 + b * 0.168)\n new_b\
\ = int(r * 0.272 + g * 0.534 + b * 0.131)\n image.putpixel((x,\
\ y), (new_r, new_g, new_b))\n return image\n"