Spaces:
Running
Running
Updated dependencies
Browse files- README.md +37 -13
- app.py +3 -7
- requirements.txt +4 -4
README.md
CHANGED
|
@@ -1,13 +1,37 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Simple Pixelart Filter
|
| 2 |
+
A Gradio [app](https://kuko6-pixel-filter.hf.space/) that allows you to pixelate images, quantize colors and display color palettes.
|
| 3 |
+
|
| 4 |
+
<p align="center">
|
| 5 |
+
<img src="example_images/bananas.jpg" alt="Bananas" width="30%">
|
| 6 |
+
<img src="example_images/bananas_out.jpeg" alt="Bananas pixelated" width="30%">
|
| 7 |
+
<img src="example_images/bananas_palette.jpeg" alt="Bananas palette" width="30%">
|
| 8 |
+
</p>
|
| 9 |
+
|
| 10 |
+
<!-- ## Features
|
| 11 |
+
- Pixelate images with customizable pixel size
|
| 12 |
+
- Apply blur effect to pixelated images
|
| 13 |
+
- Quantize using k-means clustering
|
| 14 |
+
- Interactive web interface using Gradio -->
|
| 15 |
+
|
| 16 |
+
## Try it locally
|
| 17 |
+
set up a virtual environment with:
|
| 18 |
+
```sh
|
| 19 |
+
python3 -m venv venv
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
activate the virtual environment:
|
| 23 |
+
```sh
|
| 24 |
+
source venv/bin/activate
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
install the requirements:
|
| 28 |
+
```sh
|
| 29 |
+
pip install -r requirements.txt
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
run the gradio app:
|
| 33 |
+
```sh
|
| 34 |
+
python3 app.py
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
open `127.0.0.1:7860` in your browser.
|
app.py
CHANGED
|
@@ -12,7 +12,7 @@ with gr.Blocks() as demo:
|
|
| 12 |
|
| 13 |
with gr.Row(equal_height=True):
|
| 14 |
with gr.Column(variant="panel"):
|
| 15 |
-
img = gr.Image(label="Input Image",
|
| 16 |
pixel_size = gr.Number(label="Pixel Size", minimum=1, value=16)
|
| 17 |
blur = gr.Checkbox(label="Blur")
|
| 18 |
use_palette = gr.Checkbox(label="Use Palette")
|
|
@@ -21,16 +21,12 @@ with gr.Blocks() as demo:
|
|
| 21 |
with gr.Column(variant="panel"):
|
| 22 |
output_img = gr.Image(
|
| 23 |
label="Output Image", format="jpeg",
|
| 24 |
-
|
| 25 |
-
show_share_button=False,
|
| 26 |
-
show_fullscreen_button=False
|
| 27 |
)
|
| 28 |
output_palette = gr.Image(
|
| 29 |
label="Image Palette",
|
| 30 |
format="jpeg",
|
| 31 |
-
|
| 32 |
-
show_share_button=False,
|
| 33 |
-
show_fullscreen_button=False,
|
| 34 |
show_label=False,
|
| 35 |
visible=False,
|
| 36 |
)
|
|
|
|
| 12 |
|
| 13 |
with gr.Row(equal_height=True):
|
| 14 |
with gr.Column(variant="panel"):
|
| 15 |
+
img = gr.Image(label="Input Image", buttons=["download", "share"])
|
| 16 |
pixel_size = gr.Number(label="Pixel Size", minimum=1, value=16)
|
| 17 |
blur = gr.Checkbox(label="Blur")
|
| 18 |
use_palette = gr.Checkbox(label="Use Palette")
|
|
|
|
| 21 |
with gr.Column(variant="panel"):
|
| 22 |
output_img = gr.Image(
|
| 23 |
label="Output Image", format="jpeg",
|
| 24 |
+
buttons=[],
|
|
|
|
|
|
|
| 25 |
)
|
| 26 |
output_palette = gr.Image(
|
| 27 |
label="Image Palette",
|
| 28 |
format="jpeg",
|
| 29 |
+
buttons=[],
|
|
|
|
|
|
|
| 30 |
show_label=False,
|
| 31 |
visible=False,
|
| 32 |
)
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
numpy
|
| 2 |
-
opencv-python
|
| 3 |
-
gradio
|
| 4 |
-
matplotlib
|
|
|
|
| 1 |
+
numpy==2.4.6
|
| 2 |
+
opencv-python==4.13.0.92
|
| 3 |
+
gradio==6.16.0
|
| 4 |
+
matplotlib==3.10.9
|