Spaces:
Sleeping
Sleeping
Revert "added simple ui"
Browse filesThis reverts commit 9459702e12c629586b88bd703a75b2250abea3d2.
.gradio/flagged/dataset1.csv
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
img,pixel_size,blur,output,timestamp
|
| 2 |
-
,16,true,.gradio/flagged/output/711af354289afcdc7404/image.webp,2025-02-16 11:15:54.911213
|
|
|
|
|
|
|
|
|
.gradio/flagged/output/711af354289afcdc7404/image.webp
DELETED
|
Binary file (7.92 kB)
|
|
|
app.py
DELETED
|
@@ -1,33 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import cv2
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
def pixelate(img, pixel_size: int, blur=False):
|
| 6 |
-
if blur:
|
| 7 |
-
img = cv2.blur(img, (7, 7))
|
| 8 |
-
|
| 9 |
-
for i in range(0, img.shape[0], pixel_size):
|
| 10 |
-
for j in range(0, img.shape[1], pixel_size):
|
| 11 |
-
img[i : i + pixel_size, j : j + pixel_size] = img[i][j]
|
| 12 |
-
|
| 13 |
-
return img
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
with gr.Blocks() as demo:
|
| 17 |
-
gr.Markdown("# Simple Pixelart Filter")
|
| 18 |
-
with gr.Row(scale=1):
|
| 19 |
-
with gr.Column(variant="panel"):
|
| 20 |
-
img = gr.Image(label="Input Image")
|
| 21 |
-
pixel_size = gr.Number(label="Pixel Size", minimum=1, value=16)
|
| 22 |
-
blur = gr.Checkbox(label="Blur")
|
| 23 |
-
with gr.Column():
|
| 24 |
-
output = gr.Image(
|
| 25 |
-
label="Output Image", format="jpeg", show_share_button=True
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
with gr.Column(scale=0):
|
| 29 |
-
btn = gr.Button("Pixelate", variant="primary")
|
| 30 |
-
btn.click(fn=pixelate, inputs=[img, pixel_size, blur], outputs=output)
|
| 31 |
-
btn_clear = gr.ClearButton(components=[img, pixel_size, blur, output])
|
| 32 |
-
|
| 33 |
-
demo.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|