Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,59 +22,44 @@ def pixel(image,downsample,palette,depth,upscale):
|
|
22 |
# save new image with 'skimage.io.imsave()'
|
23 |
io.imsave("pixel.png", new_image)
|
24 |
return "pixel.png"
|
25 |
-
|
26 |
title = "Pixelar Imagen"
|
27 |
description = ""
|
28 |
article = ""
|
29 |
|
30 |
with gr.Blocks() as demo:
|
31 |
gr.HTML("<h1><center> 🔥 Pixelar Imagen </center></h1>")
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
gr.Examples(
|
43 |
[
|
44 |
-
['mona.jpeg',14,7,1, 4]
|
|
|
|
|
45 |
],
|
46 |
inputs = [input_image, downsample, palette, depth, upscale]
|
47 |
)
|
48 |
|
|
|
49 |
|
50 |
-
demo.launch()
|
51 |
-
|
52 |
-
'''
|
53 |
-
gr.Interface(
|
54 |
-
pixel,
|
55 |
-
[gr.Image(label="Input"),
|
56 |
-
gr.Number(default=4, label="downsample by"),
|
57 |
-
gr.Number(default=7, label="palette"),
|
58 |
-
gr.Number(default=1, label="depth"),
|
59 |
-
gr.Number(default=14, label="upscale")
|
60 |
-
],
|
61 |
-
gr.Image(label="Output"),
|
62 |
-
title=title,
|
63 |
-
description=description,
|
64 |
-
article=article,
|
65 |
-
examples=[['mona.jpeg',14,7,1,14]],
|
66 |
-
css="footer {visibility: hidden}"
|
67 |
-
).launch(enable_queue=True)
|
68 |
|
69 |
-
|
70 |
-
pixel,
|
71 |
-
[gr.inputs.Image(type="file", label="Input", shape=(512,512)),gr.inputs.Number(default=14, label="downsample by"),gr.inputs.Number(default=7, label="palette"),gr.inputs.Number(default=1, label="depth"),gr.inputs.Number(default=14, label="upscale")
|
72 |
-
],
|
73 |
-
gr.outputs.Image(type="file", label="Output"),
|
74 |
-
title=title,
|
75 |
-
description=description,
|
76 |
-
article=article,
|
77 |
-
examples=[['mona.jpeg',14,7,1,14]],
|
78 |
-
css="footer {visibility: hidden}"
|
79 |
-
).launch(enable_queue=True)
|
80 |
-
'''
|
|
|
22 |
# save new image with 'skimage.io.imsave()'
|
23 |
io.imsave("pixel.png", new_image)
|
24 |
return "pixel.png"
|
25 |
+
|
26 |
title = "Pixelar Imagen"
|
27 |
description = ""
|
28 |
article = ""
|
29 |
|
30 |
with gr.Blocks() as demo:
|
31 |
gr.HTML("<h1><center> 🔥 Pixelar Imagen </center></h1>")
|
32 |
+
with gr.Row():
|
33 |
+
with gr.Column():
|
34 |
+
input_image = gr.Image(label="Input", height = 512 + 128)
|
35 |
+
with gr.Row():
|
36 |
+
gr.HTML('''
|
37 |
+
<h1>pyxelate⚡</h1>
|
38 |
+
<container>
|
39 |
+
<a href="https://github.com/sedthh/pyxelate" target="_blank">
|
40 |
+
<button id="website_button" class="external-link">Website</button>
|
41 |
+
</a>
|
42 |
+
</container>
|
43 |
+
''')
|
44 |
+
with gr.Column():
|
45 |
+
with gr.Row():
|
46 |
+
downsample = gr.Number(value=4, label="downsample by")
|
47 |
+
palette = gr.Number(value=7, label="palette")
|
48 |
+
depth = gr.Number(value=1, label="depth")
|
49 |
+
upscale = gr.Number(value=4, label="upscale")
|
50 |
+
run_button = gr.Button("run")
|
51 |
+
output_image = gr.Image(label="Output")
|
52 |
|
53 |
gr.Examples(
|
54 |
[
|
55 |
+
['mona.jpeg',14,7,1, 4],
|
56 |
+
['artistic sky in space.jpg',7,7,1, 4],
|
57 |
+
['Paint me a picture of the Great Wall of China in t.jpg',4, 6, 1, 4],
|
58 |
],
|
59 |
inputs = [input_image, downsample, palette, depth, upscale]
|
60 |
)
|
61 |
|
62 |
+
run_button.click(pixel, [input_image, downsample, palette, depth, upscale], output_image)
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|