NikhilJoson commited on
Commit
d7eef16
ยท
verified ยท
1 Parent(s): ceb08a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -15
app.py CHANGED
@@ -223,14 +223,23 @@ for ex_human in human_list_path:
223
  ex_dict['composite'] = None
224
  human_ex_list.append(ex_dict)
225
 
 
 
 
 
 
 
226
  topwear_list = os.listdir(os.path.join(example_path,"topwear"))
227
- topwear_list_path = [os.path.join(example_path,"topwear",topwear) for topwear in topwear_list]
 
228
 
229
  bottomwear_list = os.listdir(os.path.join(example_path,"bottomwear"))
230
- bottomwear_list_path = [os.path.join(example_path,"bottomwear",bottomwear) for bottomwear in bottomwear_list]
 
231
 
232
  dress_list = os.listdir(os.path.join(example_path,"dresses"))
233
- dress_list_path = [os.path.join(example_path,"dresses",dress) for dress in dress_list]
 
234
 
235
 
236
  image_blocks = gr.Blocks(theme="Nymbo/Alyx_Theme").queue()
@@ -250,22 +259,19 @@ with image_blocks as demo:
250
  with gr.Column(scale=1):
251
  with gr.Row():
252
  topwear_image = gr.Image(label="Topwear", sources='upload', type="pil")
253
- with gr.Row(elem_id="topwear-prompt-container"):
254
- with gr.Row():
255
- topwear_desc = gr.Textbox(placeholder="Description of garment ex) Short Sleeve Round Neck T-shirts", show_label=False, elem_id="prompt")
256
- example = gr.Examples(inputs=topwear_image, examples_per_page=4,examples=topwear_list_path)
257
  with gr.Row():
258
  bottomwear_image = gr.Image(label="Bottomwear", sources='upload', type="pil")
259
- with gr.Row(elem_id="bottomwear-prompt-container"):
260
- with gr.Row():
261
- bottomwear_desc = gr.Textbox(placeholder="Description of garment ex) Short Sleeve Round Neck T-shirts", show_label=False, elem_id="prompt")
262
- example = gr.Examples(inputs=bottomwear_image, examples_per_page=4, examples=bottomwear_list_path)
263
  with gr.Row():
264
  dress_image = gr.Image(label="Dress", sources='upload', type="pil")
265
- with gr.Row(elem_id="dress-prompt-container"):
266
- with gr.Row():
267
- dress_desc = gr.Textbox(placeholder="Description of garment ex) Short Sleeve Round Neck T-shirts", show_label=False, elem_id="prompt")
268
- example = gr.Examples(inputs=dress_image, examples_per_page=4, examples=dress_list_path)
269
 
270
  with gr.Row():
271
  with gr.Column():
 
223
  ex_dict['composite'] = None
224
  human_ex_list.append(ex_dict)
225
 
226
+ def get_examples_lst(folder_name, file_list):
227
+ example_list = []
228
+ for i in file_list:
229
+ example_list.append([os.path.join(example_path,folder_name,i),i.split(".")[0]])
230
+ return example_list
231
+
232
  topwear_list = os.listdir(os.path.join(example_path,"topwear"))
233
+ #topwear_list_path = [os.path.join(example_path,"topwear",topwear) for topwear in topwear_list]
234
+ topwear_ex_list = get_examples_lst("topwear", topwear_list)
235
 
236
  bottomwear_list = os.listdir(os.path.join(example_path,"bottomwear"))
237
+ # bottomwear_list_path = [os.path.join(example_path,"bottomwear",bottomwear) for bottomwear in bottomwear_list]
238
+ bottomwear_ex_list = get_examples_lst("bottomwear", bottomwear_list)
239
 
240
  dress_list = os.listdir(os.path.join(example_path,"dresses"))
241
+ # dress_list_path = [os.path.join(example_path,"dresses",dress) for dress in dress_list]
242
+ dress_ex_list = get_examples_lst("dresses", dress_list)
243
 
244
 
245
  image_blocks = gr.Blocks(theme="Nymbo/Alyx_Theme").queue()
 
259
  with gr.Column(scale=1):
260
  with gr.Row():
261
  topwear_image = gr.Image(label="Topwear", sources='upload', type="pil")
262
+ with gr.Row():
263
+ topwear_desc = gr.Textbox(placeholder="Description of garment ex) Short Sleeve Round Neck T-shirts", show_label=False, elem_id="prompt")
264
+ example = gr.Examples(inputs=[topwear_image,topwear_desc], examples_per_page=4,examples=topwear_ex_list)
 
265
  with gr.Row():
266
  bottomwear_image = gr.Image(label="Bottomwear", sources='upload', type="pil")
267
+ with gr.Row():
268
+ bottomwear_desc = gr.Textbox(placeholder="Description of garment ex) Cargo pants", show_label=False, elem_id="prompt")
269
+ example = gr.Examples(inputs=[bottomwear_image,bottomwear_desc], examples_per_page=4, examples=bottomwear_ex_list)
 
270
  with gr.Row():
271
  dress_image = gr.Image(label="Dress", sources='upload', type="pil")
272
+ with gr.Row():
273
+ dress_desc = gr.Textbox(placeholder="Description of garment ex) Jumper suit", show_label=False, elem_id="prompt")
274
+ example = gr.Examples(inputs=[dress_image,dress_desc], examples_per_page=4, examples=dress_ex_list)
 
275
 
276
  with gr.Row():
277
  with gr.Column():