Spaces:
Running
on
Zero
Running
on
Zero
Testing Torch Error
Browse files- app.py +44 -44
- images/Beeuty-1.png +3 -0
- images/logo.png +3 -0
- utils/ai_generator_diffusers_flux.py +25 -2
- utils/constants.py +1 -1
app.py
CHANGED
|
@@ -250,51 +250,51 @@ gr.set_static_paths(paths=["images/","images/images","images/prerendered","LUT/"
|
|
| 250 |
# Gradio Blocks Interface
|
| 251 |
with gr.Blocks(css_paths="style_20250128.css", title="HexaGrid Creator", theme='Surn/beeuty') as beeuty:
|
| 252 |
with gr.Row():
|
| 253 |
-
gr.Markdown
|
| 254 |
# HexaGrid Creator
|
| 255 |
-
## Transform Your Images into Mesmerizing Hexagon Grid Masterpieces! ⬢
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
with gr.Row():
|
| 299 |
from utils.image_utils import convert_to_rgba_png
|
| 300 |
|
|
|
|
| 250 |
# Gradio Blocks Interface
|
| 251 |
with gr.Blocks(css_paths="style_20250128.css", title="HexaGrid Creator", theme='Surn/beeuty') as beeuty:
|
| 252 |
with gr.Row():
|
| 253 |
+
gr.Markdown("""
|
| 254 |
# HexaGrid Creator
|
| 255 |
+
## Transform Your Images into Mesmerizing Hexagon Grid Masterpieces! ⬢""", elem_classes="intro")
|
| 256 |
+
with gr.Row():
|
| 257 |
+
with gr.Accordion("Welcome to HexaGrid Creator, the ultimate tool for transforming your images into stunning hexagon grid artworks. Whether you're a tabletop game enthusiast, a digital artist, or someone who loves unique patterns, HexaGrid Creator has something for you.", open=False, elem_classes="intro"):
|
| 258 |
+
gr.Markdown ("""
|
| 259 |
+
|
| 260 |
+
## Drop an image into the Input Image and get started!
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
## What is HexaGrid Creator?
|
| 265 |
+
HexaGrid Creator is a web-based application that allows you to apply a hexagon grid overlay to any image. You can customize the size, color, and opacity of the hexagons, as well as the background and border colors. The result is a visually striking image that looks like it was made from hexagonal tiles!
|
| 266 |
+
|
| 267 |
+
### What Can You Do?
|
| 268 |
+
- **Generate Hexagon Grids:** Create beautiful hexagon grid overlays on any image with fully customizable parameters.
|
| 269 |
+
- **AI-Powered Image Generation:** Use advanced AI models to generate images based on your prompts and apply hexagon grids to them.
|
| 270 |
+
- **Color Exclusion:** Select and exclude specific colors from your hexagon grid for a cleaner and more refined look.
|
| 271 |
+
- **Interactive Customization:** Adjust hexagon size, border size, rotation, background color, and more in real-time.
|
| 272 |
+
- **Depth and 3D Model Generation:** Generate depth maps and 3D models from your images for enhanced visualization.
|
| 273 |
+
- **Image Filter [Look-Up Table (LUT)] Application:** Apply filters (LUTs) to your images for color grading and enhancement.
|
| 274 |
+
- **Pre-rendered Maps:** Access a library of pre-rendered hexagon maps for quick and easy customization.
|
| 275 |
+
- **Add Margins:** Add customizable margins around your images for a polished finish.
|
| 276 |
+
|
| 277 |
+
### Why You'll Love It
|
| 278 |
+
- **Fun and Easy to Use:** With an intuitive interface and real-time previews, creating hexagon grids has never been this fun!
|
| 279 |
+
- **Endless Creativity:** Unleash your creativity with endless customization options and see your images transform in unique ways.
|
| 280 |
+
- **Hexagon-Inspired Theme:** Enjoy a delightful yellow and purple theme inspired by hexagons! ⬢
|
| 281 |
+
- **Advanced AI Models:** Leverage advanced AI models and LoRA weights for high-quality image generation and customization.
|
| 282 |
+
|
| 283 |
+
### Get Started
|
| 284 |
+
1. **Upload or Generate an Image:** Start by uploading your own image or generate one using our AI-powered tool.
|
| 285 |
+
2. **Customize Your Grid:** Play around with the settings to create the perfect hexagon grid overlay.
|
| 286 |
+
3. **Download and Share:** Once you're happy with your creation, download it and share it with the world!
|
| 287 |
+
|
| 288 |
+
### Advanced Features
|
| 289 |
+
- **Generative AI Integration:** Utilize models like `black-forest-labs/FLUX.1-dev` and various LoRA weights for generating unique images.
|
| 290 |
+
- **Pre-rendered Maps:** Access a library of pre-rendered hexagon maps for quick and easy customization.
|
| 291 |
+
- **Image Filter [Look-Up Table (LUT)] Application:** Apply filters (LUTs) to your images for color grading and enhancement.
|
| 292 |
+
- **Depth and 3D Model Generation:** Create depth maps and 3D models from your images for enhanced visualization.
|
| 293 |
+
- **Add Margins:** Customize margins around your images for a polished finish.
|
| 294 |
+
|
| 295 |
+
Join the hive and start creating with HexaGrid Creator today!
|
| 296 |
+
|
| 297 |
+
""", elem_classes="intro")
|
| 298 |
with gr.Row():
|
| 299 |
from utils.image_utils import convert_to_rgba_png
|
| 300 |
|
images/Beeuty-1.png
ADDED
|
Git LFS Details
|
images/logo.png
ADDED
|
Git LFS Details
|
utils/ai_generator_diffusers_flux.py
CHANGED
|
@@ -184,8 +184,9 @@ def generate_image_lowmem(
|
|
| 184 |
print("\nEnabled flash_attention_2.\n")
|
| 185 |
if pipeline_name == "FluxPipeline":
|
| 186 |
pipe.enable_vae_tiling()
|
|
|
|
| 187 |
# Load LoRA weights
|
| 188 |
-
# note: does not yet handle multiple LoRA weights with different names, needs .set_adapters(["depth", "hyper-sd"], adapter_weights=[0.85, 0.125])
|
| 189 |
if lora_weights:
|
| 190 |
for lora_weight in lora_weights:
|
| 191 |
lora_configs = constants.LORA_DETAILS.get(lora_weight, [])
|
|
@@ -248,6 +249,28 @@ def generate_image_lowmem(
|
|
| 248 |
method(**params)
|
| 249 |
else:
|
| 250 |
print(f"Method {method_name} not found in pipe.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
else:
|
| 252 |
pipe.load_lora_weights(lora_weight, use_auth_token=constants.HF_API_TOKEN)
|
| 253 |
# Set the random seed for reproducibility
|
|
@@ -255,7 +278,7 @@ def generate_image_lowmem(
|
|
| 255 |
conditions = []
|
| 256 |
if conditioned_image is not None:
|
| 257 |
conditioned_image = crop_and_resize_image(conditioned_image, image_width, image_height)
|
| 258 |
-
condition = Condition(
|
| 259 |
conditions.append(condition)
|
| 260 |
print(f"\nAdded conditioned image.\n {conditioned_image.size}")
|
| 261 |
# Prepare the parameters for image generation
|
|
|
|
| 184 |
print("\nEnabled flash_attention_2.\n")
|
| 185 |
if pipeline_name == "FluxPipeline":
|
| 186 |
pipe.enable_vae_tiling()
|
| 187 |
+
condition_type = "subject"
|
| 188 |
# Load LoRA weights
|
| 189 |
+
# note: does not yet handle multiple LoRA weights with different names, needs .set_adapters(["depth", "hyper-sd"], adapter_weights=[0.85, 0.125])
|
| 190 |
if lora_weights:
|
| 191 |
for lora_weight in lora_weights:
|
| 192 |
lora_configs = constants.LORA_DETAILS.get(lora_weight, [])
|
|
|
|
| 249 |
method(**params)
|
| 250 |
else:
|
| 251 |
print(f"Method {method_name} not found in pipe.")
|
| 252 |
+
if 'condition_type' in config:
|
| 253 |
+
condition_type = config['condition_type']
|
| 254 |
+
if condition_type == "coloring":
|
| 255 |
+
#pipe.enable_coloring()
|
| 256 |
+
print("\nEnabled coloring.\n")
|
| 257 |
+
elif condition_type == "deblurring":
|
| 258 |
+
#pipe.enable_deblurring()
|
| 259 |
+
print("\nEnabled deblurring.\n")
|
| 260 |
+
elif condition_type == "fill":
|
| 261 |
+
#pipe.enable_fill()
|
| 262 |
+
print("\nEnabled fill.\n")
|
| 263 |
+
elif condition_type == "depth":
|
| 264 |
+
#pipe.enable_depth()
|
| 265 |
+
print("\nEnabled depth.\n")
|
| 266 |
+
elif condition_type == "canny":
|
| 267 |
+
#pipe.enable_canny()
|
| 268 |
+
print("\nEnabled canny.\n")
|
| 269 |
+
elif condition_type == "subject":
|
| 270 |
+
#pipe.enable_subject()
|
| 271 |
+
print("\nEnabled subject.\n")
|
| 272 |
+
else:
|
| 273 |
+
print(f"Condition type {condition_type} not implemented.")
|
| 274 |
else:
|
| 275 |
pipe.load_lora_weights(lora_weight, use_auth_token=constants.HF_API_TOKEN)
|
| 276 |
# Set the random seed for reproducibility
|
|
|
|
| 278 |
conditions = []
|
| 279 |
if conditioned_image is not None:
|
| 280 |
conditioned_image = crop_and_resize_image(conditioned_image, image_width, image_height)
|
| 281 |
+
condition = Condition(condition_type, conditioned_image)
|
| 282 |
conditions.append(condition)
|
| 283 |
print(f"\nAdded conditioned image.\n {conditioned_image.size}")
|
| 284 |
# Prepare the parameters for image generation
|
utils/constants.py
CHANGED
|
@@ -166,7 +166,7 @@ LORA_TO_MODEL = {
|
|
| 166 |
"XLabs-AI/flux-lora-collection/scenery_lora.safetensors":"black-forest-labs/FLUX.1-dev",
|
| 167 |
"XLabs-AI/flux-lora-collection/disney_lora.safetensors":"black-forest-labs/FLUX.1-dev"
|
| 168 |
}
|
| 169 |
-
|
| 170 |
# Detailed LoRA weight configurations
|
| 171 |
LORA_DETAILS = {
|
| 172 |
"AlekseyCalvin/HSTcolorFlexAlpha" : [
|
|
|
|
| 166 |
"XLabs-AI/flux-lora-collection/scenery_lora.safetensors":"black-forest-labs/FLUX.1-dev",
|
| 167 |
"XLabs-AI/flux-lora-collection/disney_lora.safetensors":"black-forest-labs/FLUX.1-dev"
|
| 168 |
}
|
| 169 |
+
condition_type = ["depth", "canny", "subject", "coloring", "deblurring", "fill", "redux"]
|
| 170 |
# Detailed LoRA weight configurations
|
| 171 |
LORA_DETAILS = {
|
| 172 |
"AlekseyCalvin/HSTcolorFlexAlpha" : [
|