liuhaotian commited on
Commit
4ef7732
1 Parent(s): 886d221

Fix version

Browse files
Files changed (2) hide show
  1. app.py +2 -48
  2. requirements.txt +2 -2
app.py CHANGED
@@ -447,25 +447,12 @@ def clear(task, sketch_pad_trigger, batch_size, state, switch_task=False):
447
  return [None, sketch_pad_trigger, None, 1.0] + out_images + [state]
448
 
449
  css = """
450
- #generate-btn {
451
- --tw-border-opacity: 1;
452
- border-color: rgb(255 216 180 / var(--tw-border-opacity));
453
- --tw-gradient-from: rgb(255 216 180 / .7);
454
- --tw-gradient-to: rgb(255 216 180 / 0);
455
- --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
456
- --tw-gradient-to: rgb(255 176 102 / .8);
457
- --tw-text-opacity: 1;
458
- color: rgb(238 116 0 / var(--tw-text-opacity));
459
- }
460
- #img2img_image, #img2img_image > .h-60, #img2img_image > .h-60 > div, #img2img_image > .h-60 > div > img
461
  {
462
  height: var(--height) !important;
463
  max-height: var(--height) !important;
464
  min-height: var(--height) !important;
465
  }
466
- #mirrors a:hover {
467
- cursor:pointer;
468
- }
469
  #paper-info a {
470
  color:#008AD7;
471
  }
@@ -487,38 +474,6 @@ function(x) {
487
  }
488
  """
489
 
490
- mirror_js = """
491
- function () {
492
- const root = document.querySelector('gradio-app').shadowRoot || document.querySelector('gradio-app');
493
- const mirrors_div = root.querySelector('#mirrors');
494
- const current_url = window.location.href;
495
- const mirrors = [
496
- 'https://dev.hliu.cc/gligen_mirror1/',
497
- 'https://dev.hliu.cc/gligen_mirror2/',
498
- ];
499
-
500
- let mirror_html = '';
501
- mirror_html += '[<a href="https://gligen.github.io" target="_blank" style="">Project Page</a>]';
502
- mirror_html += '[<a href="https://arxiv.org/abs/2301.07093" target="_blank" style="">Paper</a>]';
503
- mirror_html += '[<a href="https://github.com/gligen/GLIGEN" target="_blank" style="">GitHub Repo</a>]';
504
- mirror_html += '&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;';
505
- mirror_html += 'Mirrors: ';
506
-
507
- mirrors.forEach((e, index) => {
508
- let cur_index = index + 1;
509
- if (current_url.includes(e)) {
510
- mirror_html += `[Mirror ${cur_index}] `;
511
- } else {
512
- mirror_html += `[<a onclick="window.location.href = '${e}'">Mirror ${cur_index}</a>] `;
513
- }
514
- });
515
-
516
- mirror_html = `<div class="output-markdown gr-prose" style="max-width: 100%;"><h3 style="text-align: center" id="paper-info">${mirror_html}</h3></div>`;
517
-
518
- mirrors_div.innerHTML = mirror_html;
519
- }
520
- """
521
-
522
  with Blocks(
523
  css=css,
524
  analytics_enabled=False,
@@ -530,7 +485,6 @@ with Blocks(
530
  [<a href="https://arxiv.org/abs/2301.07093" target="_blank" style="">Paper</a>]
531
  [<a href="https://github.com/gligen/GLIGEN" target="_blank" style="">GitHub Repo</a>]
532
  </h3>""")
533
- # gr.HTML("", elem_id="mirrors")
534
  gr.Markdown("To ground concepts of interest with desired spatial specification, please (1) &#9000;&#65039; enter the concept names in <em> Grounding Instruction</em>, and (2) &#128433;&#65039; draw their corresponding bounding boxes one by one using <em> Sketch Pad</em> -- the parsed boxes will be displayed automatically.")
535
  with gr.Row():
536
  with gr.Column(scale=4):
@@ -557,7 +511,7 @@ with Blocks(
557
  out_imagebox = gr.Image(type="pil", label="Parsed Sketch Pad")
558
  with gr.Row():
559
  clear_btn = gr.Button(value='Clear')
560
- gen_btn = gr.Button(value='Generate', elem_id="generate-btn")
561
  with gr.Accordion("Advanced Options", open=False):
562
  with gr.Column():
563
  alpha_sample = gr.Slider(minimum=0, maximum=1.0, step=0.1, value=0.3, label="Scheduled Sampling (τ)")
 
447
  return [None, sketch_pad_trigger, None, 1.0] + out_images + [state]
448
 
449
  css = """
450
+ #img2img_image, #img2img_image > .fixed-height, #img2img_image > .fixed-height > div, #img2img_image > .fixed-height > div > img
 
 
 
 
 
 
 
 
 
 
451
  {
452
  height: var(--height) !important;
453
  max-height: var(--height) !important;
454
  min-height: var(--height) !important;
455
  }
 
 
 
456
  #paper-info a {
457
  color:#008AD7;
458
  }
 
474
  }
475
  """
476
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
477
  with Blocks(
478
  css=css,
479
  analytics_enabled=False,
 
485
  [<a href="https://arxiv.org/abs/2301.07093" target="_blank" style="">Paper</a>]
486
  [<a href="https://github.com/gligen/GLIGEN" target="_blank" style="">GitHub Repo</a>]
487
  </h3>""")
 
488
  gr.Markdown("To ground concepts of interest with desired spatial specification, please (1) &#9000;&#65039; enter the concept names in <em> Grounding Instruction</em>, and (2) &#128433;&#65039; draw their corresponding bounding boxes one by one using <em> Sketch Pad</em> -- the parsed boxes will be displayed automatically.")
489
  with gr.Row():
490
  with gr.Column(scale=4):
 
511
  out_imagebox = gr.Image(type="pil", label="Parsed Sketch Pad")
512
  with gr.Row():
513
  clear_btn = gr.Button(value='Clear')
514
+ gen_btn = gr.Button(value='Generate')
515
  with gr.Accordion("Advanced Options", open=False):
516
  with gr.Column():
517
  alpha_sample = gr.Slider(minimum=0, maximum=1.0, step=0.1, value=0.3, label="Scheduled Sampling (τ)")
requirements.txt CHANGED
@@ -8,11 +8,11 @@ imageio==2.9.0
8
  imageio-ffmpeg==0.4.2
9
  pytorch-lightning==1.4.2
10
  test-tube>=0.7.5
11
- streamlit==1.12.1
12
  einops==0.3.0
13
  git+https://github.com/openai/CLIP.git
14
  protobuf~=3.20.1
15
  torchmetrics==0.6.0
16
  transformers==4.19.2
17
  kornia==0.6.0
18
- gradio==3.16.0
 
8
  imageio-ffmpeg==0.4.2
9
  pytorch-lightning==1.4.2
10
  test-tube>=0.7.5
11
+ streamlit==1.17.0
12
  einops==0.3.0
13
  git+https://github.com/openai/CLIP.git
14
  protobuf~=3.20.1
15
  torchmetrics==0.6.0
16
  transformers==4.19.2
17
  kornia==0.6.0
18
+ gradio==3.19.1