File size: 4,523 Bytes
b283998
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c1ca4d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from src.fal_api import fal_ipadapter_api
import gradio as gr


def create_ipadaptor_tab():
    
    with gr.TabItem("Cloth IP Adapter",id="cloth_ip_adapter"):

      with gr.Accordion("HowTo",open=False):
        gr.Markdown("""

        # Cloth IP Adapter 服のIPアタォーター \n

        ・1 Select base image  ベース画像を選択します。 \n

        ・2 Prompt area you want the IP to be applied IPを適用するためのプロンプトエリアを選択します。 \n

        ・3 Select IP image   IP画像を選択します。 \n

        ・4 Click Generate  生成をクリックします。 \n

      

        """)
        gr.Image(value="HowTo/Flow_IP_ClothAdapter.jpg",label=None,interactive=False)
        

      with gr.Row():
        with gr.Column():
          api_inp = gr.Image(label="Base Image")
          
          with gr.Accordion("Example base images", open=True):
                    human_examples = gr.Examples(
                         examples=[
                             ["Test_images/example_outputs/input_4.png"],
                            ["Test_images/man_1.png"],
                            ["Test_images/Woman_2.png"],
                            ["Test_images/Woman_3.png"],
                            ["Test_images/man_2.png"],
                            ["Test_images/Woman_4.png"],
                             ["Test_images/Woman_5.png"],
                            ["Test_images/anime_woman_1.png"],
                             ["Test_images/anime_woman_2.png"],
                            ["Test_images/anime_woman_3.png"],
                            ["Test_images/Walk_1.png"],
                            ["Test_images/Walk_2.png"],
                            ["Test_images/Walk_3.png"],
                            ["Test_images/Walk_4.png"]
                        ],
                        inputs=[api_inp],
                         examples_per_page=14
                    )
        
        with gr.Column():
          ip_image = gr.Image(label="IP Adapter Image")
          
          with gr.Accordion("Example IP images ", open=True):
                    ip_examples = gr.Examples(
                        examples=[
                              ["Test_images/Jacket_1.png"],
                            ["Test_images/Suit_4.png"],
                            ["Test_images/dress_5.png"],
                            ["Test_images/Shirt_1.png"],
                
                            ["Test_images/Style_4.png"],
                            ["Test_images/pattern_1.png"],
                            ["Test_images/pattern_2.jpg"],
                            ["Test_images/pattern_3.jpg"],
                            ["Test_images/pattern_4.jpg"],
                          
                            ["https://replicate.delivery/pbxt/Kl23gJODaW7EuxrDzBG9dcgqRdMaYSWmBQ9UexnwPiL7AnIr/3.jpg"],
                            ["https://replicate.delivery/pbxt/Kl2WefehduxwWcQc5OrrBH6AkojQ6OqyQSKBvBLrroSpEBim/f2f0488a-180e-4d7e-9907-f26f92ac5f16.jpg"],
                            ["https://replicate.delivery/pbxt/Kl2VlUibviSP8Kq5ULLJmMOWorog1YFu0zTreqhqX97c62ku/572a1fc9-a114-4d5b-8c7c-85aa5648c7b4.jpg"],
                            
                        ],
                        inputs=[ip_image],
                         examples_per_page=14
                    )
      with gr.Row():
        ap_prompt = gr.Textbox(label="clothes prompt",value="clothes",info="Clothe are you want to use 希望の服のエリア (日本語可能)")
      with gr.Row():
          ip_btn = gr.Button("Generate",elem_id="gen_btn")
      with gr.Row():
          api_out = gr.Image(label="Output",type="filepath",elem_id="output_image")
      with gr.Row(): #Move gen out row
            
            move_to_cnmk =gr.Button("Move to Control net mockup ")
            move_to_relight= gr.Button("Move to Relight")
    

      with gr.Row():
          gr.Examples(examples=[
              ["Test_images/example_outputs/input_4.png","Test_images/Jacket_1.png","Jacket","Test_images/example_outputs/output_clothIP_1.png"],
              ["Test_images/Woman_2.png","Test_images/pattern_4.jpg","Dress","Test_images/example_outputs/output_clothIP_2.png"],
          ],inputs=[api_inp,ip_image,ap_prompt,api_out])
    ip_btn.click(fal_ipadapter_api,inputs=[api_inp,ip_image,ap_prompt],outputs=api_out)
    return api_inp,api_out,move_to_cnmk,move_to_relight