JarvisLabs commited on
Commit
c27bc0a
·
verified ·
1 Parent(s): 3022039

Upload 14 files

Browse files
Files changed (6) hide show
  1. app.py +67 -12
  2. controlnetmockup_tab.py +13 -5
  3. gen_tab.py +7 -6
  4. ipadapter_tab.py +29 -11
  5. relighting_tab.py +31 -5
  6. virtualtryon_tab.py +8 -7
app.py CHANGED
@@ -7,16 +7,62 @@ from ipadapter_tab import create_ipadaptor_tab
7
  from relighting_tab import gen_relighting_tab
8
  from controlnetmockup_tab import create_cnmu_tab
9
  #from mail_tab import create_mail_tab
10
-
11
  from pattern_ip_adapter import sam_zest_tab
12
  from dotenv import load_dotenv, find_dotenv
13
  import os
14
  from src.utils import convert_to_pil
 
 
15
  gallery_list=[]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  def update_gallery(img):
18
- img=convert_to_pil(img)
19
- gallery_list.append(img)
 
 
 
 
 
 
 
 
20
  return gallery_list
21
 
22
 
@@ -34,15 +80,22 @@ css = """
34
  border-radius: 10px;
35
  }
36
 
 
37
  .gradio-container p {
38
  margin: 0;
39
  font-size: 16px;
40
  font-weight: bold;
41
  }
42
 
 
 
 
 
 
 
43
  .gradio-container .gr-button {
44
  width: 100%;
45
- background-color: #fff;
46
  border: 1px solid #ddd;
47
  padding: 10px;
48
  border-radius: 10px;
@@ -70,7 +123,7 @@ with gr.Blocks(theme=theme,css=css) as demo:
70
  input_vto,output_vto,move_to_cnmk_fm_try,move_to_relight_fm_try=create_virtualtryon_tab()
71
  #input_zest,output_zest=sam_zest_tab()
72
  #input_fs,output_fs=create_faceswap_tab()
73
- input_cnmu,output_cnmu=create_cnmu_tab()
74
  input_rl,output_rl=gen_relighting_tab()
75
  #create_train_tab()
76
 
@@ -87,16 +140,18 @@ with gr.Blocks(theme=theme,css=css) as demo:
87
  #Move to Buttons from Virtual Try On
88
  move_to_cnmk_fm_try.click(lambda x:x,inputs=output_vto,outputs=input_cnmu)
89
  move_to_relight_fm_try.click(lambda x:x,inputs=output_vto,outputs=input_rl)
90
- # move_to_zest.click(lambda x:x, inputs=gen_out,outputs=input_zest)
 
 
91
  #Gallery
92
- image_gallery = gr.Gallery(label="Generated Images Gallery",type="pil",elem_id="output_image")
93
  #Gallery updates get all outputs
94
- gen_out.change(update_gallery,inputs=gen_out,outputs=image_gallery)
95
- output_vto.change(update_gallery,inputs=output_vto,outputs=image_gallery)
96
  #output_fs.change(update_gallery,inputs=output_fs,outputs=image_gallery)
97
- output_ip.change(update_gallery,inputs=output_ip,outputs=image_gallery)
98
- output_cnmu.change(update_gallery,inputs=output_cnmu,outputs=image_gallery)
99
- output_rl.change(update_gallery,inputs=output_rl,outputs=image_gallery)
100
  #output_zest.change(update_gallery,inputs=output_zest,outputs=image_gallery)
101
 
102
 
 
7
  from relighting_tab import gen_relighting_tab
8
  from controlnetmockup_tab import create_cnmu_tab
9
  #from mail_tab import create_mail_tab
10
+ from PIL import Image
11
  from pattern_ip_adapter import sam_zest_tab
12
  from dotenv import load_dotenv, find_dotenv
13
  import os
14
  from src.utils import convert_to_pil
15
+ from datetime import datetime
16
+
17
  gallery_list=[]
18
+ # Ensure the base folder for storing images exists
19
+ base_dir = "gallery_images"
20
+ os.makedirs(base_dir, exist_ok=True)
21
+
22
+
23
+
24
+ # Function to convert and save the image to a dated folder, and update the gallery
25
+ def update_gallery_local(img):
26
+ print(type(img), len(gallery_list))
27
+
28
+ try:
29
+ # Convert the image to PIL if needed
30
+ img = convert_to_pil(img)
31
+ except:
32
+ print("Error with converting to PIL")
33
+ print(type(img),img)
34
+ return gallery_list
35
+
36
+
37
+ # Get the current date and create a folder for it
38
+ current_date = datetime.now().strftime("%Y-%m-%d")
39
+ date_folder = os.path.join(base_dir, current_date)
40
+ os.makedirs(date_folder, exist_ok=True)
41
+
42
+ # Generate a unique filename for the image
43
+ img_filename = f"generated_image_{len(gallery_list)}.png"
44
+ img_path = os.path.join(date_folder, img_filename)
45
+
46
+ # Save the image to the date folder
47
+ img.save(img_path)
48
+
49
+ # Add the file path to the gallery list
50
+ gallery_list.append(img_path)
51
+
52
+ # Return the updated gallery list with image paths
53
+ return gallery_list
54
 
55
  def update_gallery(img):
56
+
57
+ try:
58
+ print(type(img),print(len(gallery_list)))
59
+ img=convert_to_pil(img)
60
+ gallery_list.append(img)
61
+ except:
62
+ print("Error with saving image to gallery")
63
+ #img=Image.open(img)
64
+ #gallery_list.append(img)
65
+
66
  return gallery_list
67
 
68
 
 
80
  border-radius: 10px;
81
  }
82
 
83
+
84
  .gradio-container p {
85
  margin: 0;
86
  font-size: 16px;
87
  font-weight: bold;
88
  }
89
 
90
+ .gen-btn {
91
+ background-color: green;
92
+ color: white;
93
+
94
+ }
95
+
96
  .gradio-container .gr-button {
97
  width: 100%;
98
+ background-color: green;
99
  border: 1px solid #ddd;
100
  padding: 10px;
101
  border-radius: 10px;
 
123
  input_vto,output_vto,move_to_cnmk_fm_try,move_to_relight_fm_try=create_virtualtryon_tab()
124
  #input_zest,output_zest=sam_zest_tab()
125
  #input_fs,output_fs=create_faceswap_tab()
126
+ input_cnmu,output_cnmu,move_to_relight_fm_try=create_cnmu_tab()
127
  input_rl,output_rl=gen_relighting_tab()
128
  #create_train_tab()
129
 
 
140
  #Move to Buttons from Virtual Try On
141
  move_to_cnmk_fm_try.click(lambda x:x,inputs=output_vto,outputs=input_cnmu)
142
  move_to_relight_fm_try.click(lambda x:x,inputs=output_vto,outputs=input_rl)
143
+ #Move to Button From Control Net Mockup
144
+ move_to_relight_fm_try.click(lambda x:x,inputs=output_cnmu,outputs=input_rl)
145
+
146
  #Gallery
147
+ image_gallery = gr.Gallery(label="Generated Images Gallery",type="path",elem_id="output_image")
148
  #Gallery updates get all outputs
149
+ gen_out.change(update_gallery_local,inputs=gen_out,outputs=image_gallery)
150
+ output_vto.change(update_gallery_local,inputs=output_vto,outputs=image_gallery)
151
  #output_fs.change(update_gallery,inputs=output_fs,outputs=image_gallery)
152
+ output_ip.change(update_gallery_local,inputs=output_ip,outputs=image_gallery)
153
+ output_cnmu.change(update_gallery_local,inputs=output_cnmu,outputs=image_gallery)
154
+ output_rl.change(update_gallery_local,inputs=output_rl,outputs=image_gallery)
155
  #output_zest.change(update_gallery,inputs=output_zest,outputs=image_gallery)
156
 
157
 
controlnetmockup_tab.py CHANGED
@@ -6,34 +6,39 @@ import os
6
 
7
 
8
  def create_cnmu_tab():
9
- with gr.TabItem("Control net mockup Generator"):
10
  with gr.Accordion("HowTo",open=False):
11
  gr.Markdown("""
12
 
13
- # Mockup Generator \n
14
  ・1 Select base image ベース画像を選択します。 \n
15
  ・2 Update and check image object prompt 物体のプロンプトを確認と更新\n
16
  ・3 Add in background prompt 背景のプロンプトを記入 \n
17
  ・4 Click 'Generate' to create the image. Generateをクリックして画像を生成します。\n
18
 
19
  """)
 
20
  with gr.Row():
21
  with gr.Column():
22
  in_img = gr.Image(label="Input Image")
23
  object_prompt = gr.Textbox(label="Object Prompt",info="日本語対応は可能")
24
  background_prompt = gr.Textbox(label="Background Prompt",info="日本語対応は可能")
25
  style_image = gr.Image(label="Style Image",visible=False)
26
- btn = gr.Button("Generate")
27
  with gr.Accordion("Examples",open=False):
28
  gr.Examples(examples=[
29
  ["Test_images/backgrounds/Output1.png"," in the stress of japan, 8k uhd, dslr, soft lighting, high quality, film grain , colorful decorative signs in"],
 
30
 
31
  ],
32
  inputs=[style_image,background_prompt]
33
  )
34
-
 
35
  with gr.Row():
36
  out_img= gr.Image(label="OutputImage")
 
 
37
 
38
  btn.click(replicate_bgcontrolnet,inputs=[in_img,object_prompt,background_prompt],outputs=[out_img])
39
  in_img.change(replicate_caption_api,
@@ -43,10 +48,13 @@ def create_cnmu_tab():
43
  gr.Examples(
44
  examples=[
45
  ["Test_images/example_outputs/cnmu_input_1.webp","Test_images/example_outputs/cnmu_output_1.png","a bowl of soup","on a table in a Chinese restraint, 8k, table, flowers in background "],
 
 
 
46
  ],
47
  inputs=[in_img,out_img,object_prompt,background_prompt]
48
  )
49
- return in_img,out_img
50
 
51
 
52
 
 
6
 
7
 
8
  def create_cnmu_tab():
9
+ with gr.TabItem("Background changer"):
10
  with gr.Accordion("HowTo",open=False):
11
  gr.Markdown("""
12
 
13
+ # Background Generator \n
14
  ・1 Select base image ベース画像を選択します。 \n
15
  ・2 Update and check image object prompt 物体のプロンプトを確認と更新\n
16
  ・3 Add in background prompt 背景のプロンプトを記入 \n
17
  ・4 Click 'Generate' to create the image. Generateをクリックして画像を生成します。\n
18
 
19
  """)
20
+ gr.Image(value="HowTo/controlnetmockup.png",label=None,interactive=False)
21
  with gr.Row():
22
  with gr.Column():
23
  in_img = gr.Image(label="Input Image")
24
  object_prompt = gr.Textbox(label="Object Prompt",info="日本語対応は可能")
25
  background_prompt = gr.Textbox(label="Background Prompt",info="日本語対応は可能")
26
  style_image = gr.Image(label="Style Image",visible=False)
27
+
28
  with gr.Accordion("Examples",open=False):
29
  gr.Examples(examples=[
30
  ["Test_images/backgrounds/Output1.png"," in the stress of japan, 8k uhd, dslr, soft lighting, high quality, film grain , colorful decorative signs in"],
31
+ ["Test_images/example_outputs/mockup_BG_suitshop.png","suit shop in London, wooden inertia "]
32
 
33
  ],
34
  inputs=[style_image,background_prompt]
35
  )
36
+ with gr.Row():
37
+ btn = gr.Button("Generate",elem_id="gen-btn")
38
  with gr.Row():
39
  out_img= gr.Image(label="OutputImage")
40
+ with gr.Row():
41
+ move_to_relight= gr.Button("Move to Relight")
42
 
43
  btn.click(replicate_bgcontrolnet,inputs=[in_img,object_prompt,background_prompt],outputs=[out_img])
44
  in_img.change(replicate_caption_api,
 
48
  gr.Examples(
49
  examples=[
50
  ["Test_images/example_outputs/cnmu_input_1.webp","Test_images/example_outputs/cnmu_output_1.png","a bowl of soup","on a table in a Chinese restraint, 8k, table, flowers in background "],
51
+ ["Test_images/prompt_support_examples/Jacket_1.png","Test_images/example_outputs/mockup_BG.png","a back view of a man", " a night city streets of Tokyo"],
52
+ ["Test_images/example_outputs/Input_3_VTO_LoritaDress.jpg","Test_images/example_outputs/mockup_BG_runway.png","a blond woman in a red and white dress is posing for a photo","on a Fashion show run way, lights "],
53
+ ["Test_images/prompt_support_examples/Man_1.png","Test_images/example_outputs/mockup_BG_suitshop.png","a young man in a suit posing for a photo","suit shop in London, wooden inertia "]
54
  ],
55
  inputs=[in_img,out_img,object_prompt,background_prompt]
56
  )
57
+ return in_img,out_img,move_to_relight
58
 
59
 
60
 
gen_tab.py CHANGED
@@ -20,9 +20,9 @@ prompt_dict_kp ={
20
  lora_style_support = [
21
  ["ps1","Test_images/lora_support_examples/ps1.png"],
22
  ["cyberpunk","Test_images/lora_support_examples/cyberpunk.png"],
23
- ["Sioux","Test_images/lora_support_examples/Raylene.png"],
24
  ["RetroAnime1","Test_images/lora_support_examples/appleseed.png"],
25
- ["RetroAnime2","Test_images/lora_support_examples/appleseed.png"],
26
  ["half-illustration","Test_images/lora_support_examples/halfillust.png"]
27
  ]
28
 
@@ -55,15 +55,15 @@ def create_gen_tab():
55
  with gr.Column():
56
  inp = gr.Textbox(label="Prompt",info="日本語対応は可能")
57
  aspect_ratio = gr.Dropdown(list(["1:1","16:9","9:16","5:4"]),value="1:1", label="Aspect Ratio", info="Image size Aspect Ratio 画像サイズ アスペクト比")
58
- btn = gr.Button("Generate")
59
- with gr.Accordion("extra", open=False):
60
  #Control net
61
  use_control_net=gr.Checkbox(label="Use Control net",value=False)
62
  control_net_type=gr.Dropdown(["depth","canny","soft_edge"],value="depth",label="Control net type")
63
  control_net_img= gr.Image(label="Control net image",type="pil")
64
  control_net_strength = gr.Slider(0,1,value=0.4,label="control net strength")
65
  control_net_examples = gr.Examples(
66
- examples=["Test_images/Walk_3.png","Test_images/example_outputs/input_2.png","Test_images/Sit_1.png"],
67
  inputs=[control_net_img]
68
  )
69
 
@@ -84,7 +84,8 @@ def create_gen_tab():
84
  style_strength = gr.Slider(0,2,value=1,label="Style Strength")
85
 
86
 
87
-
 
88
 
89
  with gr.Accordion("Prompt Support", open=False):
90
  for i,item in enumerate(prompt_support):
 
20
  lora_style_support = [
21
  ["ps1","Test_images/lora_support_examples/ps1.png"],
22
  ["cyberpunk","Test_images/lora_support_examples/cyberpunk.png"],
23
+ ["Sioux","Test_images/Walk_4.png"],
24
  ["RetroAnime1","Test_images/lora_support_examples/appleseed.png"],
25
+ ["RetroAnime2","Test_images/lora_support_examples/Galverse.png"],
26
  ["half-illustration","Test_images/lora_support_examples/halfillust.png"]
27
  ]
28
 
 
55
  with gr.Column():
56
  inp = gr.Textbox(label="Prompt",info="日本語対応は可能")
57
  aspect_ratio = gr.Dropdown(list(["1:1","16:9","9:16","5:4"]),value="1:1", label="Aspect Ratio", info="Image size Aspect Ratio 画像サイズ アスペクト比")
58
+
59
+ with gr.Accordion("Control Net", open=False):
60
  #Control net
61
  use_control_net=gr.Checkbox(label="Use Control net",value=False)
62
  control_net_type=gr.Dropdown(["depth","canny","soft_edge"],value="depth",label="Control net type")
63
  control_net_img= gr.Image(label="Control net image",type="pil")
64
  control_net_strength = gr.Slider(0,1,value=0.4,label="control net strength")
65
  control_net_examples = gr.Examples(
66
+ examples=["Test_images/Walk_3.png","Test_images/example_outputs/input_2.png","Test_images/example_outputs/input_4.png","Test_images/Sit_1.png","Test_images/controlnet-in-automatic1111-for-character-design-sheets-v0-ir6p0gdwpfia1.webp"],
67
  inputs=[control_net_img]
68
  )
69
 
 
84
  style_strength = gr.Slider(0,2,value=1,label="Style Strength")
85
 
86
 
87
+ with gr.Row():
88
+ btn = gr.Button("Generate")
89
 
90
  with gr.Accordion("Prompt Support", open=False):
91
  for i,item in enumerate(prompt_support):
ipadapter_tab.py CHANGED
@@ -13,21 +13,21 @@ def create_ipadaptor_tab():
13
  ・2 Prompt area you want the IP to be applied IPを適用するためのプロンプトエリアを選択します。 \n
14
  ・3 Select IP image IP画像を選択します。 \n
15
  ・4 Click Generate 生成をクリックします。 \n
16
-
17
- ![](./HowTo/Flow_IP_ClothAdapter.jpg)
18
  """)
19
- gr.Image(value="HowTo/Flow_IP_ClothAdapter.jpg",interactive=False)
20
 
21
 
22
  with gr.Row():
23
  with gr.Column():
24
  api_inp = gr.Image(label="Base Image")
25
- ap_prompt = gr.Textbox(label="clothe prompt")
26
- with gr.Accordion("Example People", open=False):
27
  human_examples = gr.Examples(
28
  examples=[
29
  ["Test_images/Woman_1.png"],
30
  ["Test_images/man_1.png"],
 
31
  ["Test_images/Woman_2.png"],
32
  ["Test_images/Woman_3.png"],
33
  ["Test_images/man_2.png"],
@@ -39,16 +39,17 @@ def create_ipadaptor_tab():
39
  ["Test_images/Jump.png"],
40
  ["Test_images/Walk_1.png"],
41
  ["Test_images/Walk_2.png"],
42
- ["Test_images/Walk_girl_1.png"],
43
- ["Test_images/Walk_girl_2.png"]
44
  ],
45
- inputs=[api_inp]
 
46
  )
47
 
48
  with gr.Column():
49
  ip_image = gr.Image(label="IP Adapter Image")
50
- ip_btn = gr.Button("Process")
51
- with gr.Accordion("Example Stles and clothes ", open=False):
52
  ip_examples = gr.Examples(
53
  examples=[
54
  ["Test_images/style_1.jpg"],
@@ -59,13 +60,22 @@ def create_ipadaptor_tab():
59
  ["Test_images/pattern_2.jpg"],
60
  ["Test_images/pattern_3.jpg"],
61
  ["Test_images/pattern_4.jpg"],
 
 
 
 
62
  ["https://replicate.delivery/pbxt/Kl23gJODaW7EuxrDzBG9dcgqRdMaYSWmBQ9UexnwPiL7AnIr/3.jpg"],
63
  ["https://replicate.delivery/pbxt/Kl2WefehduxwWcQc5OrrBH6AkojQ6OqyQSKBvBLrroSpEBim/f2f0488a-180e-4d7e-9907-f26f92ac5f16.jpg"],
64
  ["https://replicate.delivery/pbxt/Kl2VlUibviSP8Kq5ULLJmMOWorog1YFu0zTreqhqX97c62ku/572a1fc9-a114-4d5b-8c7c-85aa5648c7b4.jpg"],
65
  ["https://replicate.delivery/pbxt/Kl2VCw1UVIJsYw9r8iqSYUMm65ePJhfYOLNolOE8CwxfRjX2/28481ff0-0829-42af-a658-fb96be2abb3d.jpg"],
66
  ],
67
- inputs=[ip_image]
 
68
  )
 
 
 
 
69
  with gr.Row():
70
  api_out = gr.Image(label="Output",type="filepath",elem_id="output_image")
71
  with gr.Row(): #Move gen out row
@@ -74,4 +84,12 @@ def create_ipadaptor_tab():
74
  move_to_relight= gr.Button("Move to Relight")
75
  ip_btn.click(fal_ipadapter_api,inputs=[api_inp,ip_image,ap_prompt],outputs=api_out)
76
 
 
 
 
 
 
 
 
 
77
  return api_inp,api_out,move_to_cnmk,move_to_relight
 
13
  ・2 Prompt area you want the IP to be applied IPを適用するためのプロンプトエリアを選択します。 \n
14
  ・3 Select IP image IP画像を選択します。 \n
15
  ・4 Click Generate 生成をクリックします。 \n
16
+
 
17
  """)
18
+ gr.Image(value="HowTo/Flow_IP_ClothAdapter.jpg",label=None,interactive=False)
19
 
20
 
21
  with gr.Row():
22
  with gr.Column():
23
  api_inp = gr.Image(label="Base Image")
24
+
25
+ with gr.Accordion("Example base images", open=False):
26
  human_examples = gr.Examples(
27
  examples=[
28
  ["Test_images/Woman_1.png"],
29
  ["Test_images/man_1.png"],
30
+ ["Test_images/example_outputs/input_4.png"],
31
  ["Test_images/Woman_2.png"],
32
  ["Test_images/Woman_3.png"],
33
  ["Test_images/man_2.png"],
 
39
  ["Test_images/Jump.png"],
40
  ["Test_images/Walk_1.png"],
41
  ["Test_images/Walk_2.png"],
42
+ ["Test_images/Walk_3.png"],
43
+ ["Test_images/Walk_4.png"]
44
  ],
45
+ inputs=[api_inp],
46
+ examples_per_page=14
47
  )
48
 
49
  with gr.Column():
50
  ip_image = gr.Image(label="IP Adapter Image")
51
+
52
+ with gr.Accordion("Example IP images ", open=False):
53
  ip_examples = gr.Examples(
54
  examples=[
55
  ["Test_images/style_1.jpg"],
 
60
  ["Test_images/pattern_2.jpg"],
61
  ["Test_images/pattern_3.jpg"],
62
  ["Test_images/pattern_4.jpg"],
63
+ ["Test_images/Jacket_1.png"],
64
+ ["Test_images/Suit_4.png"],
65
+ ["Test_images/dress_5.png"],
66
+ ["Test_images/Shirt_1.png"],
67
  ["https://replicate.delivery/pbxt/Kl23gJODaW7EuxrDzBG9dcgqRdMaYSWmBQ9UexnwPiL7AnIr/3.jpg"],
68
  ["https://replicate.delivery/pbxt/Kl2WefehduxwWcQc5OrrBH6AkojQ6OqyQSKBvBLrroSpEBim/f2f0488a-180e-4d7e-9907-f26f92ac5f16.jpg"],
69
  ["https://replicate.delivery/pbxt/Kl2VlUibviSP8Kq5ULLJmMOWorog1YFu0zTreqhqX97c62ku/572a1fc9-a114-4d5b-8c7c-85aa5648c7b4.jpg"],
70
  ["https://replicate.delivery/pbxt/Kl2VCw1UVIJsYw9r8iqSYUMm65ePJhfYOLNolOE8CwxfRjX2/28481ff0-0829-42af-a658-fb96be2abb3d.jpg"],
71
  ],
72
+ inputs=[ip_image],
73
+ examples_per_page=14
74
  )
75
+ with gr.Row():
76
+ ap_prompt = gr.Textbox(label="clothes prompt",value="clothes",info="Clothe are you want to use 希望の服のエリア (日本語可能)")
77
+ with gr.Row():
78
+ ip_btn = gr.Button("Generate",elem_id="gen_btn")
79
  with gr.Row():
80
  api_out = gr.Image(label="Output",type="filepath",elem_id="output_image")
81
  with gr.Row(): #Move gen out row
 
84
  move_to_relight= gr.Button("Move to Relight")
85
  ip_btn.click(fal_ipadapter_api,inputs=[api_inp,ip_image,ap_prompt],outputs=api_out)
86
 
87
+ with gr.Row():
88
+ gr.Examples(examples=[
89
+ ["Test_images/example_outputs/input_4.png","Test_images/Jacket_1.png","Jacket","Test_images/example_outputs/output_clothIP_1.png"],
90
+ ["Test_images/Woman_2.png","Test_images/pattern_4.jpg","Dress","Test_images/example_outputs/output_clothIP_2.png"],
91
+ ["","","",""],
92
+ ["","","",""],
93
+ ],inputs=[api_inp,ip_image,ap_prompt,api_out])
94
+
95
  return api_inp,api_out,move_to_cnmk,move_to_relight
relighting_tab.py CHANGED
@@ -6,13 +6,27 @@ from src.rep_api import replicate_iclight_BG,light_source_options
6
  def gen_relighting_tab():
7
  with gr.TabItem("Re-Lighting"):
8
  gr.Markdown("### Upload Images and Set Light Source")
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  img_input = gr.Image(label="Input Image", type="pil")
11
  bg_img_input = gr.Image(label="Background Image", type="pil")
12
 
13
  with gr.Row():
14
  with gr.Column():
15
- gr.Examples(examples=[
 
 
16
  ["Test_images/anime_woman_2.png"],
17
  ["Test_images/prompt_support_examples/Woman_1.png"],
18
  ["Test_images/example_outputs/Input_4_VTO_ColorFullJacket.jpg"],
@@ -21,7 +35,9 @@ def gen_relighting_tab():
21
 
22
  ],inputs=[img_input])
23
  with gr.Column():
24
- gr.Examples(examples=
 
 
25
  [
26
  ["https://replicate.delivery/pbxt/KxPIbJUjSmVBlvn0M3C8PAz6brN5Z0eyZSGcKIVw3XfJ6vNV/7.webp"],
27
  ["Test_images/Lighting/Ligthing_1.webp"],
@@ -34,8 +50,9 @@ def gen_relighting_tab():
34
  prompt_input = gr.Textbox(label="Prompt", placeholder="Enter prompt here")
35
  light_source = gr.Dropdown(label="Light Source", choices=light_source_options, value="Use Background Image")
36
 
 
37
 
38
- submit_btn = gr.Button("Generate")
39
  output_image = gr.Image(label="Output Image")
40
 
41
  # Link the submit button to the replicate_iclight_BG function
@@ -44,5 +61,14 @@ def gen_relighting_tab():
44
  inputs=[img_input, prompt_input, bg_img_input, light_source],
45
  outputs=output_image
46
  )
47
-
48
- return img_input, bg_img_input
 
 
 
 
 
 
 
 
 
 
6
  def gen_relighting_tab():
7
  with gr.TabItem("Re-Lighting"):
8
  gr.Markdown("### Upload Images and Set Light Source")
9
+
10
+ with gr.Accordion("HowTo",open=False):
11
+ gr.Markdown("""
12
+
13
+ # Relight Generator \n
14
+ ・1 Select base image ベース画像を選択します。 \n
15
+ ・2 Update and check image object prompt 物体のプロンプトを確認と更新\n
16
+ ・3 Add in background prompt 背景のプロンプトを記入 \n
17
+ ・4 Click 'Generate' to create the image. Generateをクリックして画像を生成します。\n
18
+
19
+ """)
20
+ gr.Image(label=None,value="HowTo/ReLight.png",interactive=False)
21
 
22
  img_input = gr.Image(label="Input Image", type="pil")
23
  bg_img_input = gr.Image(label="Background Image", type="pil")
24
 
25
  with gr.Row():
26
  with gr.Column():
27
+ gr.Examples(
28
+ label="example Images ",
29
+ examples=[
30
  ["Test_images/anime_woman_2.png"],
31
  ["Test_images/prompt_support_examples/Woman_1.png"],
32
  ["Test_images/example_outputs/Input_4_VTO_ColorFullJacket.jpg"],
 
35
 
36
  ],inputs=[img_input])
37
  with gr.Column():
38
+ gr.Examples(
39
+ label="Example Light Source",
40
+ examples=
41
  [
42
  ["https://replicate.delivery/pbxt/KxPIbJUjSmVBlvn0M3C8PAz6brN5Z0eyZSGcKIVw3XfJ6vNV/7.webp"],
43
  ["Test_images/Lighting/Ligthing_1.webp"],
 
50
  prompt_input = gr.Textbox(label="Prompt", placeholder="Enter prompt here")
51
  light_source = gr.Dropdown(label="Light Source", choices=light_source_options, value="Use Background Image")
52
 
53
+ bg_img_input.change( lambda x: "Use Background Image",inputs=bg_img_input, outputs=light_source)
54
 
55
+ submit_btn = gr.Button("Generate",elem_id="gen-btn")
56
  output_image = gr.Image(label="Output Image")
57
 
58
  # Link the submit button to the replicate_iclight_BG function
 
61
  inputs=[img_input, prompt_input, bg_img_input, light_source],
62
  outputs=output_image
63
  )
64
+ examples = gr.Examples(
65
+ examples=[
66
+ ["Test_images/Walk_4.png","Test_images/Lighting/Lighing_3.webp","Use Background Image","A girl walking","Test_images/example_outputs/Re_light_output1.png"],
67
+ ["Test_images/prompt_support_examples/Woman_1.png","https://replicate.delivery/pbxt/KxPIbJUjSmVBlvn0M3C8PAz6brN5Z0eyZSGcKIVw3XfJ6vNV/7.webp","Use Background Image","a girl wearing a jacket ","Test_images/example_outputs/Re_light_output2.png"],
68
+ ["Test_images/example_outputs/Input_4_VTO_ColorFullJacket.jpg",None,"Bottom Light","a girl wearing a jacket","Test_images/example_outputs/Re_light_output3.png"],
69
+ ["Test_images/Woman_5.png",None,"Right Light","a image of a girl from the side","Test_images/example_outputs/Re_light_output4.png"],
70
+ ["Test_images/Woman_5.png","Test_images/Lighting/Ligthing_1.webp","Use Background Image","a image of a girl from the side","Test_images/example_outputs/Re_light_output5.png"],
71
+ ],
72
+ inputs=[img_input,bg_img_input,light_source,prompt_input,output_image],
73
+ )
74
+ return img_input, output_image
virtualtryon_tab.py CHANGED
@@ -30,7 +30,7 @@ def create_virtualtryon_tab():
30
  ["Test_images/Woman_1.png"],
31
  ["Test_images/prompt_support_examples/Man_1.png"],
32
  ["Test_images/Woman_2.png"],
33
- ["Test_images/prompt_support_examples/Man2_2.png"],
34
  ["Test_images/Woman_3.png"],
35
  ["Test_images/man_1.png"],
36
  ["Test_images/Woman_4.png"],
@@ -51,7 +51,9 @@ def create_virtualtryon_tab():
51
  cloth_examples = gr.Examples(
52
  examples=[
53
  ["Test_images/pink_jumper.png","pink jumper","upper_body"],
 
54
  ["Test_images/Suit_2.png","Suit","upper_body"],
 
55
  ["Test_images/Jacket_1.png","Colorfull leather jacket","upper_body"],
56
  ["Test_images/Jacket_2.png","White jacket","upper_body"],
57
  ["Test_images/Shirt_1.png","Shirt","upper_body"],
@@ -60,17 +62,16 @@ def create_virtualtryon_tab():
60
  ["Test_images/dress_3.png","pink dress","dresses"],
61
  ["Test_images/dress_4.png","red dress","dresses"],
62
  ["Test_images/dress_5.png","golden dress","dresses"],
63
- ["Test_images/Shoes_1.png","Shoes","lower_body"],
64
- ["Test_images/Shoes_2.png","Shoes","lower_body"],
65
- ["Test_images/Nike_RTFKT_Dunk_Void_1.jpg","lower_body"]
66
-
67
  ],
68
  inputs=[garm_img,garment_des,category],
69
- examples_per_page=4
70
  )
71
 
72
  with gr.Row():
73
- tryon_btn = gr.Button("Try-on")
74
  with gr.Row():
75
  tryon_out = gr.Image(label="Output", type="filepath",elem_id="output_image")
76
  with gr.Row(): #Move gen out row
 
30
  ["Test_images/Woman_1.png"],
31
  ["Test_images/prompt_support_examples/Man_1.png"],
32
  ["Test_images/Woman_2.png"],
33
+ ["Test_images/prompt_support_examples/Man_2.png"],
34
  ["Test_images/Woman_3.png"],
35
  ["Test_images/man_1.png"],
36
  ["Test_images/Woman_4.png"],
 
51
  cloth_examples = gr.Examples(
52
  examples=[
53
  ["Test_images/pink_jumper.png","pink jumper","upper_body"],
54
+ ["Test_images/Suit_1.png","Suit","upper_body"],
55
  ["Test_images/Suit_2.png","Suit","upper_body"],
56
+ ["Test_images/Suit_4.png","Suit","upper_body"],
57
  ["Test_images/Jacket_1.png","Colorfull leather jacket","upper_body"],
58
  ["Test_images/Jacket_2.png","White jacket","upper_body"],
59
  ["Test_images/Shirt_1.png","Shirt","upper_body"],
 
62
  ["Test_images/dress_3.png","pink dress","dresses"],
63
  ["Test_images/dress_4.png","red dress","dresses"],
64
  ["Test_images/dress_5.png","golden dress","dresses"],
65
+ ["Test_images/dress_6.png","brown dress","dresses"],
66
+ ["Test_images/dress_7.png","pink dress","dresses"],
67
+ ["Test_images/Suit_4.png","one-piece suit","upper_body"],
 
68
  ],
69
  inputs=[garm_img,garment_des,category],
70
+ examples_per_page=8
71
  )
72
 
73
  with gr.Row():
74
+ tryon_btn = gr.Button("Try-on",elem_id="gen-btn")
75
  with gr.Row():
76
  tryon_out = gr.Image(label="Output", type="filepath",elem_id="output_image")
77
  with gr.Row(): #Move gen out row