Ahsen Khaliq commited on
Commit
39004a3
1 Parent(s): 40351ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -2,12 +2,12 @@ import gradio as gr
2
  from skimage import io
3
  from pyxelate import Pyx, Pal
4
 
5
- def pixel(image):
6
  image = io.imread(image.name)
7
- downsample_by = 14 # new image will be 1/14th of the original in size
8
- palette = 7 # find 7 colors
9
  # 1) Instantiate Pyx transformer
10
- pyx = Pyx(factor=downsample_by, palette=palette,depth=2,upscale = 14)
11
  # 2) fit an image, allow Pyxelate to learn the color palette
12
  pyx.fit(image)
13
  # 3) transform image to pixel art using the learned color palette
@@ -22,7 +22,8 @@ article = "<p style='text-align: center'><a href='https://github.com/sedthh/pyxe
22
 
23
  gr.Interface(
24
  pixel,
25
- [gr.inputs.Image(type="file", label="Input")],
 
26
  gr.outputs.Image(type="file", label="Output"),
27
  title=title,
28
  description=description,
 
2
  from skimage import io
3
  from pyxelate import Pyx, Pal
4
 
5
+ def pixel(image,downsample,palette,depth,upscale):
6
  image = io.imread(image.name)
7
+ downsample_by = downsample # new image will be 1/14th of the original in size
8
+ palette = palette # find 7 colors
9
  # 1) Instantiate Pyx transformer
10
+ pyx = Pyx(factor=downsample_by, palette=palette,depth=depth,upscale = upscale)
11
  # 2) fit an image, allow Pyxelate to learn the color palette
12
  pyx.fit(image)
13
  # 3) transform image to pixel art using the learned color palette
 
22
 
23
  gr.Interface(
24
  pixel,
25
+ [gr.inputs.Image(type="file", label="Input"),gr.inputs.Number(default=14, label="downsample by"),gr.inputs.Number(default=7, label="palette"),gr.inputs.Number(default=2, label="depth"),gr.inputs.Number(default=14, label="upscale")
26
+ ],
27
  gr.outputs.Image(type="file", label="Output"),
28
  title=title,
29
  description=description,