File size: 1,302 Bytes
1e8ea80
8585771
934eae2
1e8ea80
 
6aa303a
1e8ea80
 
 
 
 
 
 
8585771
934eae2
 
 
1e8ea80
8585771
934eae2
 
 
1e8ea80
8585771
1e8ea80
 
934eae2
 
1e8ea80
8585771
 
 
 
 
 
 
 
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
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()"