MrajaR
commited on
Commit
·
54e2641
1
Parent(s):
01087aa
add description in gradio app
Browse files
app.py
CHANGED
@@ -511,11 +511,20 @@ class CreativeImageSuite:
|
|
511 |
|
512 |
# Text-to-Image Section
|
513 |
gr.Markdown("## Text to Image Feature")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
514 |
with gr.Row():
|
515 |
-
prompt_input = gr.Textbox(label="
|
516 |
-
generate_button = gr.Button("
|
517 |
-
output_image = gr.Image(label="Generated Image")
|
518 |
-
download_button = gr.File(label="Download
|
519 |
|
520 |
generate_button.click(self.inference.text_to_image,
|
521 |
inputs=prompt_input,
|
@@ -523,11 +532,20 @@ class CreativeImageSuite:
|
|
523 |
|
524 |
# Image-to-Image Section
|
525 |
gr.Markdown("## Image to Image Feature")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
526 |
with gr.Row():
|
527 |
-
input_image = gr.Image(label="Upload
|
528 |
-
prompt_modification = gr.Textbox(label="
|
529 |
-
modify_button = gr.Button("
|
530 |
-
modified_output_image = gr.Image(label="Modified Image")
|
531 |
download_modified_button = gr.File(label="Download Modified Image", type="filepath")
|
532 |
|
533 |
modify_button.click(self.inference.text_image_to_image,
|
@@ -536,32 +554,41 @@ class CreativeImageSuite:
|
|
536 |
|
537 |
# Background Removal and Resizing Section
|
538 |
gr.Markdown("## Image Background Removal and Resizing with Optional Watermark")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
539 |
with gr.Row():
|
540 |
-
input_files = gr.File(label="Upload
|
541 |
-
watermark = gr.File(label="Upload
|
542 |
|
543 |
with gr.Row():
|
544 |
-
canvas_size = gr.Radio(choices=["Rox", "Columbia", "Zalora"], label="
|
545 |
-
output_format = gr.Radio(choices=["PNG", "JPG"], label="
|
546 |
-
num_workers = gr.Slider(minimum=1, maximum=16, step=1, label="
|
547 |
|
548 |
with gr.Row():
|
549 |
-
bg_method = gr.Radio(choices=["bria", "rembg", None], label="
|
550 |
-
bg_choice = gr.Radio(choices=["transparent", "white", "custom"], label="
|
551 |
-
custom_color = gr.ColorPicker(label="
|
552 |
|
553 |
-
process_button = gr.Button("
|
554 |
with gr.Row():
|
555 |
gallery_processed = gr.Gallery(label="Processed Images")
|
556 |
with gr.Row():
|
557 |
-
image_original = gr.Image(label="Original
|
558 |
-
image_processed = gr.Image(label="Processed
|
559 |
with gr.Row():
|
560 |
-
original_ratio = gr.Textbox(label="
|
561 |
-
processed_ratio = gr.Textbox(label="
|
562 |
with gr.Row():
|
563 |
-
output_zip = gr.File(label="Download Processed Images
|
564 |
-
processing_time = gr.Textbox(label="Processing Time (seconds)")
|
565 |
|
566 |
bg_choice.change(self.show_color_picker, inputs=bg_choice, outputs=custom_color)
|
567 |
process_button.click(self.master_process, inputs=[input_files, bg_method, watermark, canvas_size, output_format, bg_choice, custom_color, num_workers],
|
|
|
511 |
|
512 |
# Text-to-Image Section
|
513 |
gr.Markdown("## Text to Image Feature")
|
514 |
+
gr.Markdown("""
|
515 |
+
*Create Visuals from Your Imagination*
|
516 |
+
|
517 |
+
This feature allows you to generate unique images from a simple text description. Just type your idea in the box, and our tool will bring it to life in seconds.
|
518 |
+
- Example Prompts:
|
519 |
+
- "Generate an image of a kitchenset with modern furniture."
|
520 |
+
- "Generate an image of a casual turtleneck shirt."
|
521 |
+
- "A futuristic laptop on a white background ."
|
522 |
+
""")
|
523 |
with gr.Row():
|
524 |
+
prompt_input = gr.Textbox(label="Describe your vision to generate a unique image:")
|
525 |
+
generate_button = gr.Button("Create Image")
|
526 |
+
output_image = gr.Image(label="Your Generated Image")
|
527 |
+
download_button = gr.File(label="Download Image", type="filepath")
|
528 |
|
529 |
generate_button.click(self.inference.text_to_image,
|
530 |
inputs=prompt_input,
|
|
|
532 |
|
533 |
# Image-to-Image Section
|
534 |
gr.Markdown("## Image to Image Feature")
|
535 |
+
gr.Markdown("""
|
536 |
+
*Enhance or Transform Your Existing Images*
|
537 |
+
|
538 |
+
Upload an image and describe the changes you'd like to see. From subtle edits to artistic transformations, this feature helps you bring new life to your visuals.
|
539 |
+
- Example Edits:
|
540 |
+
- "Change the Color of the bag"
|
541 |
+
- "Add plastic to the suitcase."
|
542 |
+
- "mirror this photo of denim jacket."
|
543 |
+
""")
|
544 |
with gr.Row():
|
545 |
+
input_image = gr.Image(label="Upload an image to modify:", type="pil")
|
546 |
+
prompt_modification = gr.Textbox(label="Describe the changes you want:")
|
547 |
+
modify_button = gr.Button("Apply Changes")
|
548 |
+
modified_output_image = gr.Image(label="Your Modified Image")
|
549 |
download_modified_button = gr.File(label="Download Modified Image", type="filepath")
|
550 |
|
551 |
modify_button.click(self.inference.text_image_to_image,
|
|
|
554 |
|
555 |
# Background Removal and Resizing Section
|
556 |
gr.Markdown("## Image Background Removal and Resizing with Optional Watermark")
|
557 |
+
gr.Markdown("""
|
558 |
+
*Perfect Your Images for Any Use Case*
|
559 |
+
|
560 |
+
Easily remove backgrounds, resize images to fit your needs, and even add watermarks to maintain originality or branding. This feature is ideal for e-commerce, social media, and design projects.
|
561 |
+
- Features:
|
562 |
+
- Supports batch processing of multiple images or ZIP/RAR files.
|
563 |
+
- Options for transparent, solid color, or custom backgrounds.
|
564 |
+
- Output in your choice of PNG or JPG format.
|
565 |
+
""")
|
566 |
with gr.Row():
|
567 |
+
input_files = gr.File(label="Upload an image or a ZIP/RAR file for batch processing:", file_types=[".zip", ".rar", "image"], interactive=True)
|
568 |
+
watermark = gr.File(label="Upload an optional watermark (PNG only):", file_types=[".png"])
|
569 |
|
570 |
with gr.Row():
|
571 |
+
canvas_size = gr.Radio(choices=["Rox", "Columbia", "Zalora"], label="Select the desired canvas size:", value="Rox")
|
572 |
+
output_format = gr.Radio(choices=["PNG", "JPG"], label="Choose the output format:", value="JPG")
|
573 |
+
num_workers = gr.Slider(minimum=1, maximum=16, step=1, label="Set the number of processing threads:", value=5)
|
574 |
|
575 |
with gr.Row():
|
576 |
+
bg_method = gr.Radio(choices=["bria", "rembg", None], label="Choose a background removal method:", value="bria")
|
577 |
+
bg_choice = gr.Radio(choices=["transparent", "white", "custom"], label="Select a background style:", value="white")
|
578 |
+
custom_color = gr.ColorPicker(label="Pick a custom background color (if applicable):", value="#ffffff", visible=False)
|
579 |
|
580 |
+
process_button = gr.Button("Start Processing")
|
581 |
with gr.Row():
|
582 |
gallery_processed = gr.Gallery(label="Processed Images")
|
583 |
with gr.Row():
|
584 |
+
image_original = gr.Image(label="Original Image Preview", interactive=False)
|
585 |
+
image_processed = gr.Image(label="Processed Image Preview", interactive=False)
|
586 |
with gr.Row():
|
587 |
+
original_ratio = gr.Textbox(label="Aspect Ratio (Original)")
|
588 |
+
processed_ratio = gr.Textbox(label="Aspect Ratio (Processed)")
|
589 |
with gr.Row():
|
590 |
+
output_zip = gr.File(label="Download All Processed Images (ZIP)")
|
591 |
+
processing_time = gr.Textbox(label="Total Processing Time (seconds)")
|
592 |
|
593 |
bg_choice.change(self.show_color_picker, inputs=bg_choice, outputs=custom_color)
|
594 |
process_button.click(self.master_process, inputs=[input_files, bg_method, watermark, canvas_size, output_format, bg_choice, custom_color, num_workers],
|