JingyeChen commited on
Commit
d147789
1 Parent(s): 03cb796
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -27,7 +27,7 @@ if not os.path.exists('images2'):
27
 
28
 
29
  # if not os.path.exists('architecture.jpg'):
30
- os.system('wget https://huggingface.co/JingyeChen22/textdiffuser2-full-ft/tree/main/layout_planner_m1')
31
 
32
  # if not os.path.exists('gray256.jpg'):
33
  # os.system('wget https://huggingface.co/JingyeChen22/textdiffuser2-full-ft/blob/main/gray256.jpg')
@@ -338,7 +338,8 @@ def text_to_image(prompt,keywords,slider_step,slider_guidance,slider_batch,slide
338
  new_image.paste(image, (col*width, row*height))
339
  # new_image.save(f'{args.output_dir}/pred_img_{sample_index}_{args.local_rank}.jpg')
340
  results.insert(0, new_image)
341
- return new_image
 
342
 
343
  with gr.Blocks() as demo:
344
 
@@ -361,11 +362,11 @@ with gr.Blocks() as demo:
361
 
362
  <style>
363
  .scaled-image {
364
- transform: scale(0.75);
365
  }
366
  </style>
367
 
368
- <img src="https://i.ibb.co/q1hxH0N/architecture.jpg" alt="textdiffuser-2" class="scaled-image">
369
  </div>
370
  """)
371
 
@@ -378,7 +379,7 @@ with gr.Blocks() as demo:
378
  # 这里加一个会话框
379
  with gr.Row():
380
  with gr.Column(scale=1):
381
- i = gr.Image(label="Template", type='filepath', value=f'./gray256.jpg', height=256, width=256)
382
  with gr.Column(scale=1):
383
  t = gr.Textbox(label="Template", placeholder='keyword')
384
  redo = gr.Button(value='Redo - Cancel the last keyword') # 如何给b绑定事件
@@ -399,7 +400,7 @@ with gr.Blocks() as demo:
399
  button = gr.Button("Generate")
400
 
401
  with gr.Column(scale=1):
402
- output = gr.Image(label='Generated image')
403
 
404
  # with gr.Accordion("Intermediate results", open=False):
405
  # gr.Markdown("Layout, segmentation mask, and details of segmentation mask from left to right.")
@@ -414,7 +415,7 @@ with gr.Blocks() as demo:
414
 
415
  gr.HTML(
416
  """
417
- <div style="text-align: justify; max-width: 1200px; margin: 20px auto;">
418
  <h3 style="font-weight: 450; font-size: 0.8rem; margin: 0rem">
419
  <b>Version</b>: 1.0
420
  </h3>
 
27
 
28
 
29
  # if not os.path.exists('architecture.jpg'):
30
+ # os.system('wget https://huggingface.co/JingyeChen22/textdiffuser2-full-ft/tree/main/layout_planner_m1')
31
 
32
  # if not os.path.exists('gray256.jpg'):
33
  # os.system('wget https://huggingface.co/JingyeChen22/textdiffuser2-full-ft/blob/main/gray256.jpg')
 
338
  new_image.paste(image, (col*width, row*height))
339
  # new_image.save(f'{args.output_dir}/pred_img_{sample_index}_{args.local_rank}.jpg')
340
  results.insert(0, new_image)
341
+ # return new_image
342
+ return tuple(new_image)
343
 
344
  with gr.Blocks() as demo:
345
 
 
362
 
363
  <style>
364
  .scaled-image {
365
+ transform: scale(1);
366
  }
367
  </style>
368
 
369
+ <img src="https://i.ibb.co/vmrXRb5/architecture.jpg" alt="textdiffuser-2" class="scaled-image">
370
  </div>
371
  """)
372
 
 
379
  # 这里加一个会话框
380
  with gr.Row():
381
  with gr.Column(scale=1):
382
+ i = gr.Image(label="Template (Click to paint)", type='filepath', value=f'./gray256.jpg', height=256, width=256)
383
  with gr.Column(scale=1):
384
  t = gr.Textbox(label="Template", placeholder='keyword')
385
  redo = gr.Button(value='Redo - Cancel the last keyword') # 如何给b绑定事件
 
400
  button = gr.Button("Generate")
401
 
402
  with gr.Column(scale=1):
403
+ output = gr.Gallery(label='Generated image')
404
 
405
  # with gr.Accordion("Intermediate results", open=False):
406
  # gr.Markdown("Layout, segmentation mask, and details of segmentation mask from left to right.")
 
415
 
416
  gr.HTML(
417
  """
418
+ <div style="text-align: justify; max-width: 1100px; margin: 20px auto;">
419
  <h3 style="font-weight: 450; font-size: 0.8rem; margin: 0rem">
420
  <b>Version</b>: 1.0
421
  </h3>