Spaces:
Running
on
A100
Running
on
A100
update
Browse files
app.py
CHANGED
@@ -173,8 +173,8 @@ def load_pipeline(use_distilled: bool = False, device: str = "cuda"):
|
|
173 |
enable_refiner_offloading=True
|
174 |
)
|
175 |
pipeline.to('cpu')
|
176 |
-
refiner_pipeline = pipeline.refiner_pipeline
|
177 |
-
refiner_pipeline.to('cpu')
|
178 |
reprompt_model = pipeline.reprompt_model
|
179 |
|
180 |
print("β Pipeline loaded successfully")
|
@@ -442,9 +442,9 @@ def create_interface(auto_load: bool = True, use_distilled: bool = False, device
|
|
442 |
info="Enhance prompt automatically"
|
443 |
)
|
444 |
use_refiner = gr.Checkbox(
|
445 |
-
label="Use Refiner", value=
|
446 |
-
info="Apply refiner after generation",
|
447 |
-
interactive=
|
448 |
)
|
449 |
|
450 |
generate_btn = gr.Button("π¨ Generate Image", variant="primary", size="lg")
|
@@ -501,71 +501,71 @@ def create_interface(auto_load: bool = True, use_distilled: bool = False, device
|
|
501 |
)
|
502 |
|
503 |
# # Tab 3: Image Refinement
|
504 |
-
with gr.Tab("π§ Image Refinement"):
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
|
555 |
-
|
556 |
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
|
570 |
# Event handlers
|
571 |
generate_btn.click(
|
@@ -583,14 +583,14 @@ def create_interface(auto_load: bool = True, use_distilled: bool = False, device
|
|
583 |
outputs=[enhanced_prompt, enhancement_status]
|
584 |
)
|
585 |
|
586 |
-
refine_btn.click(
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
)
|
594 |
|
595 |
# Additional info
|
596 |
gr.Markdown(
|
|
|
173 |
enable_refiner_offloading=True
|
174 |
)
|
175 |
pipeline.to('cpu')
|
176 |
+
# refiner_pipeline = pipeline.refiner_pipeline
|
177 |
+
# refiner_pipeline.to('cpu')
|
178 |
reprompt_model = pipeline.reprompt_model
|
179 |
|
180 |
print("β Pipeline loaded successfully")
|
|
|
442 |
info="Enhance prompt automatically"
|
443 |
)
|
444 |
use_refiner = gr.Checkbox(
|
445 |
+
label="Use Refiner", value=False,
|
446 |
+
info="Apply refiner after generation (comming soon)",
|
447 |
+
interactive=False
|
448 |
)
|
449 |
|
450 |
generate_btn = gr.Button("π¨ Generate Image", variant="primary", size="lg")
|
|
|
501 |
)
|
502 |
|
503 |
# # Tab 3: Image Refinement
|
504 |
+
# with gr.Tab("π§ Image Refinement"):
|
505 |
+
# with gr.Row():
|
506 |
+
# with gr.Column(scale=1):
|
507 |
+
# gr.Markdown("### Refinement Settings")
|
508 |
+
# gr.Markdown("**Model**: HunyuanImage v2.1 Refiner")
|
509 |
|
510 |
+
# input_image = gr.Image(
|
511 |
+
# label="Input Image",
|
512 |
+
# type="pil",
|
513 |
+
# height=300
|
514 |
+
# )
|
515 |
|
516 |
+
# refine_prompt = gr.Textbox(
|
517 |
+
# label="Refinement Prompt",
|
518 |
+
# placeholder="Make the image more detailed and high quality",
|
519 |
+
# lines=2,
|
520 |
+
# value="Make the image more detailed and high quality"
|
521 |
+
# )
|
522 |
|
523 |
+
# refine_negative_prompt = gr.Textbox(
|
524 |
+
# label="Negative Prompt",
|
525 |
+
# placeholder="",
|
526 |
+
# lines=2,
|
527 |
+
# value=""
|
528 |
+
# )
|
529 |
|
530 |
+
# with gr.Row():
|
531 |
+
# refine_width = gr.Slider(
|
532 |
+
# minimum=512, maximum=2048, step=64, value=2048,
|
533 |
+
# label="Width", info="Output width"
|
534 |
+
# )
|
535 |
+
# refine_height = gr.Slider(
|
536 |
+
# minimum=512, maximum=2048, step=64, value=2048,
|
537 |
+
# label="Height", info="Output height"
|
538 |
+
# )
|
539 |
|
540 |
+
# with gr.Row():
|
541 |
+
# refine_steps = gr.Slider(
|
542 |
+
# minimum=1, maximum=20, step=1, value=4,
|
543 |
+
# label="Refinement Steps", info="More steps = more refinement"
|
544 |
+
# )
|
545 |
+
# refine_guidance = gr.Slider(
|
546 |
+
# minimum=1.0, maximum=10.0, step=0.1, value=3.5,
|
547 |
+
# label="Guidance Scale", info="How strongly to follow the prompt"
|
548 |
+
# )
|
549 |
|
550 |
+
# refine_seed = gr.Number(
|
551 |
+
# label="Seed", value=-1, precision=0,
|
552 |
+
# info="Random seed for reproducibility"
|
553 |
+
# )
|
554 |
|
555 |
+
# refine_btn = gr.Button("π§ Refine Image", variant="primary", size="lg")
|
556 |
|
557 |
+
# with gr.Column(scale=1):
|
558 |
+
# gr.Markdown("### Refined Image")
|
559 |
+
# refined_image = gr.Image(
|
560 |
+
# label="Refined Image",
|
561 |
+
# type="pil",
|
562 |
+
# height=600
|
563 |
+
# )
|
564 |
+
# refinement_status = gr.Textbox(
|
565 |
+
# label="Status",
|
566 |
+
# interactive=False,
|
567 |
+
# value="Ready to refine"
|
568 |
+
# )
|
569 |
|
570 |
# Event handlers
|
571 |
generate_btn.click(
|
|
|
583 |
outputs=[enhanced_prompt, enhancement_status]
|
584 |
)
|
585 |
|
586 |
+
# refine_btn.click(
|
587 |
+
# fn=app.refine_image,
|
588 |
+
# inputs=[
|
589 |
+
# input_image, refine_prompt, refine_negative_prompt,
|
590 |
+
# refine_width, refine_height, refine_steps, refine_guidance, refine_seed
|
591 |
+
# ],
|
592 |
+
# outputs=[refined_image, refinement_status]
|
593 |
+
# )
|
594 |
|
595 |
# Additional info
|
596 |
gr.Markdown(
|