thalismind commited on
Commit ·
325a997
1
Parent(s): 0ed11ca
update for spaces
Browse files- .gitignore +34 -1
- README.SPACE.md +39 -0
- README.md +8 -2
- app.py +5 -0
.gitignore
CHANGED
|
@@ -1,2 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
venv/
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
*.so
|
| 6 |
+
.Python
|
| 7 |
+
build/
|
| 8 |
+
develop-eggs/
|
| 9 |
+
dist/
|
| 10 |
+
downloads/
|
| 11 |
+
eggs/
|
| 12 |
+
.eggs/
|
| 13 |
+
lib/
|
| 14 |
+
lib64/
|
| 15 |
+
parts/
|
| 16 |
+
sdist/
|
| 17 |
+
var/
|
| 18 |
+
wheels/
|
| 19 |
+
*.egg-info/
|
| 20 |
+
.installed.cfg
|
| 21 |
+
*.egg
|
| 22 |
+
|
| 23 |
+
# Virtual Environment
|
| 24 |
venv/
|
| 25 |
+
ENV/
|
| 26 |
+
|
| 27 |
+
# IDE
|
| 28 |
+
.idea/
|
| 29 |
+
.vscode/
|
| 30 |
+
*.swp
|
| 31 |
+
*.swo
|
| 32 |
+
|
| 33 |
+
# OS
|
| 34 |
+
.DS_Store
|
| 35 |
+
Thumbs.db
|
README.SPACE.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Pixel Art Converter
|
| 3 |
+
emoji: 🎨
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 4.0.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Pixel Art Converter
|
| 13 |
+
|
| 14 |
+
Convert your images into pixel art with customizable palettes! This application supports both dynamic and fixed color palettes, with various color matching modes.
|
| 15 |
+
|
| 16 |
+
## Features
|
| 17 |
+
|
| 18 |
+
- Convert images to pixel art with customizable pixel sizes
|
| 19 |
+
- Two palette modes:
|
| 20 |
+
- Dynamic: Automatically generates an optimal palette using K-means clustering
|
| 21 |
+
- Fixed: Uses colors from a provided palette image
|
| 22 |
+
- Multiple color matching modes:
|
| 23 |
+
- RGB: Matches colors based on RGB distance
|
| 24 |
+
- Hue: Matches colors based on hue similarity
|
| 25 |
+
- Brightness: Matches colors based on grayscale brightness
|
| 26 |
+
|
| 27 |
+
## How to Use
|
| 28 |
+
|
| 29 |
+
1. Upload an input image using the "Input Image" component
|
| 30 |
+
2. Choose between dynamic or fixed palette mode
|
| 31 |
+
3. For dynamic palette: Set the number of colors (2-32)
|
| 32 |
+
4. For fixed palette: Upload a palette image containing the colors you want to use
|
| 33 |
+
5. Select the color matching mode (RGB, Hue, or Brightness)
|
| 34 |
+
6. Adjust the pixel size if desired
|
| 35 |
+
7. Click "Convert to Pixel Art" to process the image
|
| 36 |
+
|
| 37 |
+
## Creating a Palette Image
|
| 38 |
+
|
| 39 |
+
For fixed palette mode, create an image containing the colors you want to use. Each color should be represented by at least one pixel. The order of colors doesn't matter, and you can use any arrangement of the colors in the image.
|
README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
| 2 |
|
| 3 |
A Python application that converts images into pixel art using Gradio for the user interface. The application supports both dynamic and fixed color palettes, with various color matching modes.
|
| 4 |
|
|
|
|
|
|
|
| 5 |
## Features
|
| 6 |
|
| 7 |
- Convert images to pixel art with customizable pixel sizes
|
|
@@ -14,7 +16,7 @@ A Python application that converts images into pixel art using Gradio for the us
|
|
| 14 |
- Brightness: Matches colors based on grayscale brightness
|
| 15 |
- Interactive Gradio interface with drag-and-drop support
|
| 16 |
|
| 17 |
-
## Installation
|
| 18 |
|
| 19 |
1. Clone this repository
|
| 20 |
2. Install the required dependencies:
|
|
@@ -22,7 +24,7 @@ A Python application that converts images into pixel art using Gradio for the us
|
|
| 22 |
pip install -r requirements.txt
|
| 23 |
```
|
| 24 |
|
| 25 |
-
## Usage
|
| 26 |
|
| 27 |
1. Run the application:
|
| 28 |
```bash
|
|
@@ -44,6 +46,10 @@ python pixelize.py
|
|
| 44 |
|
| 45 |
For fixed palette mode, create an image containing the colors you want to use. Each color should be represented by at least one pixel. The order of colors doesn't matter, and you can use any arrangement of the colors in the image.
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
## License
|
| 48 |
|
| 49 |
This project is open source and available under the MIT License.
|
|
|
|
| 2 |
|
| 3 |
A Python application that converts images into pixel art using Gradio for the user interface. The application supports both dynamic and fixed color palettes, with various color matching modes.
|
| 4 |
|
| 5 |
+
[](https://huggingface.co/spaces)
|
| 6 |
+
|
| 7 |
## Features
|
| 8 |
|
| 9 |
- Convert images to pixel art with customizable pixel sizes
|
|
|
|
| 16 |
- Brightness: Matches colors based on grayscale brightness
|
| 17 |
- Interactive Gradio interface with drag-and-drop support
|
| 18 |
|
| 19 |
+
## Local Installation
|
| 20 |
|
| 21 |
1. Clone this repository
|
| 22 |
2. Install the required dependencies:
|
|
|
|
| 24 |
pip install -r requirements.txt
|
| 25 |
```
|
| 26 |
|
| 27 |
+
## Local Usage
|
| 28 |
|
| 29 |
1. Run the application:
|
| 30 |
```bash
|
|
|
|
| 46 |
|
| 47 |
For fixed palette mode, create an image containing the colors you want to use. Each color should be represented by at least one pixel. The order of colors doesn't matter, and you can use any arrangement of the colors in the image.
|
| 48 |
|
| 49 |
+
## HuggingFace Spaces
|
| 50 |
+
|
| 51 |
+
This application is also available as a HuggingFace Space. You can try it out directly in your browser without any installation required.
|
| 52 |
+
|
| 53 |
## License
|
| 54 |
|
| 55 |
This project is open source and available under the MIT License.
|
app.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pixelize import create_interface
|
| 2 |
+
|
| 3 |
+
# Create and launch the interface
|
| 4 |
+
interface = create_interface()
|
| 5 |
+
interface.launch()
|