adamelliotfields commited on
Commit
1fdf076
·
verified ·
1 Parent(s): 7f1904f

Increase duration requests

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. lib/inference.py +8 -3
app.py CHANGED
@@ -310,7 +310,7 @@ with gr.Blocks(
310
  triggers=[generate_btn.click, prompt.submit],
311
  fn=generate_fn,
312
  api_name="generate",
313
- concurrency_limit=5,
314
  outputs=[output_images],
315
  inputs=[
316
  prompt,
 
310
  triggers=[generate_btn.click, prompt.submit],
311
  fn=generate_fn,
312
  api_name="generate",
313
+ concurrency_limit=4,
314
  outputs=[output_images],
315
  inputs=[
316
  prompt,
lib/inference.py CHANGED
@@ -74,14 +74,19 @@ def apply_style(prompt, style_id, negative=False):
74
  return prompt
75
 
76
 
77
- # TODO: fine-tune these
78
  def gpu_duration(**kwargs):
 
79
  duration = 20
80
  scale = kwargs.get("scale", 1)
81
  num_images = kwargs.get("num_images", 1)
82
- if scale == 4:
 
 
 
 
 
83
  duration += 10
84
- return duration * num_images
85
 
86
 
87
  @spaces.GPU(duration=gpu_duration)
 
74
  return prompt
75
 
76
 
 
77
  def gpu_duration(**kwargs):
78
+ base = 20
79
  duration = 20
80
  scale = kwargs.get("scale", 1)
81
  num_images = kwargs.get("num_images", 1)
82
+ use_refiner = kwargs.get("use_refiner", False)
83
+ if use_refiner:
84
+ base += 10
85
+ if scale == 2:
86
+ duration += 5
87
+ elif scale == 4:
88
  duration += 10
89
+ return base + (duration * num_images)
90
 
91
 
92
  @spaces.GPU(duration=gpu_duration)