File size: 1,276 Bytes
1e8ea80
 
934eae2
1e8ea80
 
934eae2
1e8ea80
 
 
 
 
 
 
934eae2
 
 
 
1e8ea80
934eae2
 
 
 
1e8ea80
 
 
 
934eae2
 
1e8ea80
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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"