Deadmon commited on
Commit
5771779
1 Parent(s): 7d9191a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -48
app.py CHANGED
@@ -34,35 +34,14 @@ positive_prompt_str = "Full HD, 4K, high quality, high resolution"
34
  examples_path = root_path / '__assets__/demo/examples'
35
  example_inputs = [
36
  [f'{examples_path}/images_1024/a40.jpg', f'{examples_path}/images_2048/a40.jpg', 'medieval castle'],
37
- [f'{examples_path}/images_1024/a4.jpg', f'{examples_path}/images_2048/a4.jpg', 'parrot'],
38
- [f'{examples_path}/images_1024/a65.jpg', f'{examples_path}/images_2048/a65.jpg', 'hoodie'],
39
- [f'{examples_path}/images_1024/a54.jpg', f'{examples_path}/images_2048/a54.jpg', 'salad'],
40
- [f'{examples_path}/images_1024/a51.jpg', f'{examples_path}/images_2048/a51.jpg', 'space helmet'],
41
- [f'{examples_path}/images_1024/a46.jpg', f'{examples_path}/images_2048/a46.jpg', 'stack of books'],
42
- [f'{examples_path}/images_1024/a19.jpg', f'{examples_path}/images_2048/a19.jpg', 'antique greek vase'],
43
- [f'{examples_path}/images_1024/a2.jpg', f'{examples_path}/images_2048/a2.jpg', 'sunglasses'],
44
  ]
45
 
46
  thumbnails = [
47
  'https://lh3.googleusercontent.com/pw/ABLVV87bkFc_SRKrbXuk5BTp18dETNm18MLbjoJo6JvwbIkYtjZXrjU_H1dCJIP799OJjHTZmo19mYVyMCC1RLmwqzoZrgwQzfB-SCtxLa83IbXBQ23xzmKoZgsRlPztxNJD6gmXzFyatdLRzDxHIusBQLUz=w3580-h1150-s-no-gm',
48
- 'https://lh3.googleusercontent.com/pw/ABLVV85RWtrpTf1tMp2p3q37eg5DlFp5znifALK_JTjvxJua8UYMjytVoEy2GUW2cLXgBvQyYKg7GvrWXQ5hkdAsyih5Rf4rFnDq-JoiQYhVZHStCZLKxmeAlQna5ZwMPVTKG1TK63DH_OdK58gvSjWtF2ww=w3580-h1152-s-no-gm',
49
- 'https://lh3.googleusercontent.com/pw/ABLVV84dkaU6SQs9fyDjajpk1X9JkYp_zQBEnPVL67oi11_05U6-Ys5ydQpuny8GBQCMyVbFKxJ5unn9w__gmP9K0cKQ4_IVoT7Hvfmya71klDqSI7vu9Iy_5P2Il5-0giJFpumtffBA3kryn1xtJdR4vSA0=w2924-h1858-s-no-gm',
50
- 'https://lh3.googleusercontent.com/pw/ABLVV853ZyjvS4LvcPpVMY9BWz-232omt3-hgRiGcky_3ojE6WLKgtsrftsg1jSrUm2ccT_UOa279CulZy6fdnH_Xg1SunyRBxaRjOK0uxAkUFwb60rR1S4hI2MmhLV7KCi3tw1A-oiGi0f9JINyade-322A=w2622-h1858-s-no-gm',
51
- 'https://lh3.googleusercontent.com/pw/ABLVV86AJGUVGjb0i6CPg8zlJlWObNY0xdOzM1x5Bq9gKhP-ZWre5aaexRJDxQUO2gmJtRIyohD88FJDG_aVX2G5M0QOyGRWlZmx7tOVXLh-Kbesobxo9MfD-wqk9Ts9O8NUGtIwkWzo9SEs2opKdu83gB9F=w2528-h1858-s-no-gm',
52
- 'https://lh3.googleusercontent.com/pw/ABLVV87MplTciS7z-4i-eY3B3L0YhaK8UEQ3pTQD6W6uYVGR4hPD9u1WGEGyfg5ddqU-Bx2BrKskDhwxzF746cRhgFU5aPtbYA_-O7KfqXe9IsMxYCgUKxEHBm2ncqy64V-w-N8XOFgUMkAQqcuuNZ8Xapqp=w3580-h1186-s-no-gm',
53
- 'https://lh3.googleusercontent.com/pw/ABLVV877Esi6l2Kuw3akH5QBlmDAbWydZDZEEJqlZ_N-X7g33NQZU8nv_UKdAVETS7q23byTuldIAhW-q99zCycFB8Yfc-5e_WPNIM9icU0p3gd6DUVZR233ZNUtLca384MYGIhMGud9Y_Xed1I3PpiMhrpG=w2846-h1858-s-no-gm',
54
- 'https://lh3.googleusercontent.com/pw/ABLVV85hMQbSB6fCokdyut4ke7xTUqjERhuYygnj7T8IIA1k48e9GkaowDywPZzi5QJzZfj7wU3bgBHzjxop19qK1zOi5XDrjfXkn5bwj4MxicHa3TG-Rc-V-c1uyZVUyviyUlkGZ62FxuVROw2x0aGJIcr0=w3580-h1382-s-no-gm'
55
  ]
56
 
57
  example_previews = [
58
  [thumbnails[0], 'Prompt: medieval castle'],
59
- [thumbnails[1], 'Prompt: parrot'],
60
- [thumbnails[2], 'Prompt: hoodie'],
61
- [thumbnails[3], 'Prompt: salad'],
62
- [thumbnails[4], 'Prompt: space helmet'],
63
- [thumbnails[5], 'Prompt: stack of books'],
64
- [thumbnails[6], 'Prompt: antique greek vase'],
65
- [thumbnails[7], 'Prompt: sunglasses'],
66
  ]
67
 
68
  # Load models
@@ -244,34 +223,10 @@ def upscale_run(
244
  with gr.Blocks(css=demo_path / 'style.css') as demo:
245
  gr.HTML(
246
  """
247
- <div style="text-align: center; max-width: 1200px; margin: 20px auto;">
248
- <h1 style="font-weight: 900; font-size: 3rem; margin-bottom: 0.5rem">
249
- 🧑‍🎨 HD-Painter Demo
250
- </h1>
251
- <h2 style="font-weight: 450; font-size: 1rem; margin: 0rem">
252
- Hayk Manukyan<sup>1*</sup>, Andranik Sargsyan<sup>1*</sup>, Barsegh Atanyan<sup>1</sup>, Zhangyang Wang<sup>1,2</sup>, Shant Navasardyan<sup>1</sup>
253
- and <a href="https://www.humphreyshi.com/home">Humphrey Shi</a><sup>1,3</sup>
254
- </h2>
255
- <h2 style="font-weight: 450; font-size: 1rem; margin: 0rem">
256
- <sup>1</sup>Picsart AI Resarch (PAIR), <sup>2</sup>UT Austin, <sup>3</sup>Georgia Tech
257
- </h2>
258
- <h2 style="font-weight: 450; font-size: 1rem; margin: 0rem">
259
- [<a href="https://arxiv.org/abs/2312.14091" style="color:blue;">arXiv</a>]
260
- [<a href="https://github.com/Picsart-AI-Research/HD-Painter" style="color:blue;">GitHub</a>]
261
- </h2>
262
- <h2 style="font-weight: 450; font-size: 1rem; margin: 0.7rem auto; max-width: 1000px">
263
- <b>HD-Painter</b> enables prompt-faithfull and high resolution (up to 2k) image inpainting upon any diffusion-based image inpainting method.
264
- </h2>
265
- </div>
266
  """)
267
 
268
  if on_huggingspace:
269
- gr.HTML("""
270
- <p>For faster inference without waiting in queue, you may duplicate the space and upgrade to the suggested GPU in settings.
271
- <br/>
272
- <a href="https://huggingface.co/spaces/PAIR/HD-Painter?duplicate=true">
273
- <img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
274
- </p>""")
275
 
276
  with open(demo_path / 'script.js', 'r') as f:
277
  js_str = f.read()
@@ -325,9 +280,9 @@ with gr.Blocks(css=demo_path / 'style.css') as demo:
325
  elem_id='outputgallery'
326
  )
327
  with gr.Row():
328
- upscale_btn = gr.Button("Send to Inpainting-Specialized Super-Resolution (x4)", scale = 1)
329
  with gr.Row():
330
- use_sam_mask = gr.Checkbox(value = False, label = "Use SAM mask for background preservation (for SR only, experimental feature)")
331
  with gr.Row():
332
  hires_image = gr.Image(label = "Hi-res Image")
333
 
 
34
  examples_path = root_path / '__assets__/demo/examples'
35
  example_inputs = [
36
  [f'{examples_path}/images_1024/a40.jpg', f'{examples_path}/images_2048/a40.jpg', 'medieval castle'],
 
 
 
 
 
 
 
37
  ]
38
 
39
  thumbnails = [
40
  'https://lh3.googleusercontent.com/pw/ABLVV87bkFc_SRKrbXuk5BTp18dETNm18MLbjoJo6JvwbIkYtjZXrjU_H1dCJIP799OJjHTZmo19mYVyMCC1RLmwqzoZrgwQzfB-SCtxLa83IbXBQ23xzmKoZgsRlPztxNJD6gmXzFyatdLRzDxHIusBQLUz=w3580-h1150-s-no-gm',
 
 
 
 
 
 
 
41
  ]
42
 
43
  example_previews = [
44
  [thumbnails[0], 'Prompt: medieval castle'],
 
 
 
 
 
 
 
45
  ]
46
 
47
  # Load models
 
223
  with gr.Blocks(css=demo_path / 'style.css') as demo:
224
  gr.HTML(
225
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  """)
227
 
228
  if on_huggingspace:
229
+ gr.HTML("""""")
 
 
 
 
 
230
 
231
  with open(demo_path / 'script.js', 'r') as f:
232
  js_str = f.read()
 
280
  elem_id='outputgallery'
281
  )
282
  with gr.Row():
283
+ upscale_btn = gr.Button("Send to Upscaler (x4)", scale = 1)
284
  with gr.Row():
285
+ use_sam_mask = gr.Checkbox(value = False, label = "Use SAM mask for background preservation")
286
  with gr.Row():
287
  hires_image = gr.Image(label = "Hi-res Image")
288