Spaces:
Running
Running
added examples
Browse files- .gitignore +0 -3
- app.py +16 -2
- example_images/cat.jpg +0 -0
- example_images/cow.jpg +0 -0
- example_images/ducks.jpg +0 -0
- example_images/scream.jpg +0 -0
.gitignore
CHANGED
@@ -3,6 +3,3 @@
|
|
3 |
.vscode/
|
4 |
|
5 |
imgs/
|
6 |
-
|
7 |
-
*.jpg
|
8 |
-
*.jpeg
|
|
|
3 |
.vscode/
|
4 |
|
5 |
imgs/
|
|
|
|
|
|
app.py
CHANGED
@@ -57,7 +57,7 @@ def pixelate(img, pixel_size: int, blur=False, use_palette=False, k=8):
|
|
57 |
|
58 |
|
59 |
def update_palette_visibility(use_palette):
|
60 |
-
return gr.update(visible=use_palette),
|
61 |
|
62 |
|
63 |
with gr.Blocks() as demo:
|
@@ -99,4 +99,18 @@ with gr.Blocks() as demo:
|
|
99 |
components=[img, blur, output_img, output_palette, use_palette]
|
100 |
)
|
101 |
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
|
59 |
def update_palette_visibility(use_palette):
|
60 |
+
return gr.update(visible=use_palette), gr.update(visible=use_palette)
|
61 |
|
62 |
|
63 |
with gr.Blocks() as demo:
|
|
|
99 |
components=[img, blur, output_img, output_palette, use_palette]
|
100 |
)
|
101 |
|
102 |
+
with gr.Column():
|
103 |
+
gr.Markdown("## Examples")
|
104 |
+
gr.Examples(
|
105 |
+
examples=[
|
106 |
+
["example_images/scream.jpg", 16, False, True, 4],
|
107 |
+
["example_images/cat.jpg", 32, True, False, None],
|
108 |
+
["example_images/ducks.jpg", 4, False, True, 2],
|
109 |
+
],
|
110 |
+
inputs=[img, pixel_size, blur, use_palette, k],
|
111 |
+
outputs=[output_img, output_palette],
|
112 |
+
run_on_click=True,
|
113 |
+
fn=pixelate,
|
114 |
+
)
|
115 |
+
|
116 |
+
demo.launch(debug=True)
|
example_images/cat.jpg
ADDED
![]() |
example_images/cow.jpg
ADDED
![]() |
example_images/ducks.jpg
ADDED
![]() |
example_images/scream.jpg
ADDED
![]() |