lzyhha commited on
Commit
849f598
·
1 Parent(s): 77cc452
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -321,15 +321,18 @@ def create_demo(model):
321
  images[i].append(inputs[i * max_grid_w + j])
322
  if i != model.grid_h - 1:
323
  if inputs[i * max_grid_w + j] is None:
324
- raise gr.Error('Please upload in-context examples.')
325
  seed, cfg, steps, upsampling_steps, upsampling_noise, layout_text, task_text, content_text = inputs[-8:]
326
-
327
- results = generate(
328
- images,
329
- [layout_text, task_text, content_text],
330
- seed=seed, cfg=cfg, steps=steps,
331
- upsampling_steps=upsampling_steps, upsampling_noise=upsampling_noise
332
- )
 
 
 
333
 
334
  output = gr.update(
335
  elem_id='output_gallery',
@@ -471,7 +474,7 @@ def create_demo(model):
471
 
472
 
473
  # @spaces.GPU(duration=120)
474
- @spaces.GPU()
475
  def generate(
476
  images,
477
  prompts,
 
321
  images[i].append(inputs[i * max_grid_w + j])
322
  if i != model.grid_h - 1:
323
  if inputs[i * max_grid_w + j] is None:
324
+ raise gr.Error('Please upload in-context examples. Possible that the task examples have not finished loading yet.')
325
  seed, cfg, steps, upsampling_steps, upsampling_noise, layout_text, task_text, content_text = inputs[-8:]
326
+
327
+ try:
328
+ results = generate(
329
+ images,
330
+ [layout_text, task_text, content_text],
331
+ seed=seed, cfg=cfg, steps=steps,
332
+ upsampling_steps=upsampling_steps, upsampling_noise=upsampling_noise
333
+ )
334
+ except Exception as e:
335
+ raise gr.Error('Process error. Possible that the task examples have not finished loading yet. Error: ' + e)
336
 
337
  output = gr.update(
338
  elem_id='output_gallery',
 
474
 
475
 
476
  # @spaces.GPU(duration=120)
477
+ @spaces.GPU(5)
478
  def generate(
479
  images,
480
  prompts,