anzorq commited on
Commit
894f870
1 Parent(s): e8b3929

1. cache examples. 2. concurrency=2

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -29,6 +29,7 @@ model = RiffusionPipeline.from_pretrained(
29
 
30
  if torch.cuda.is_available():
31
  model.to("cuda")
 
32
 
33
  pipe_inpaint = StableDiffusionInpaintPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, safety_checker=lambda images, **kwargs: (images, False),)
34
  pipe_inpaint.scheduler = DPMSolverMultistepScheduler.from_config(pipe_inpaint.scheduler.config)
@@ -37,6 +38,7 @@ pipe_inpaint.scheduler = DPMSolverMultistepScheduler.from_config(pipe_inpaint.sc
37
 
38
  if torch.cuda.is_available():
39
  pipe_inpaint = pipe_inpaint.to("cuda")
 
40
 
41
 
42
  def get_init_image(image, overlap, feel):
@@ -309,7 +311,7 @@ with gr.Blocks(css=css) as app:
309
  ["typing", "dance beat", "og_beat", 10],
310
  ["synthwave", "jazz", "agile", 10],
311
  ["rap battle freestyle", "", "og_beat", 10],
312
- ["techno club banger", "", "og_beat", 10],
313
  ["reggae dub beat", "sunset chill", "og_beat", 10],
314
  ["acoustic folk ballad", "", "agile", 10],
315
  ["blues guitar riff", "", "agile", 5],
@@ -318,7 +320,8 @@ with gr.Blocks(css=css) as app:
318
  ["rock and roll power chord", "", "motorway", 5],
319
  ["soulful R&B love song", "", "marim", 10],
320
  ["country western twangy guitar", "", "agile", 10]],
321
- inputs=[prompt_1, prompt_2, feel, num_iterations])
 
322
 
323
  gr.HTML("""
324
  <div style="border-top: 1px solid #303030;">
@@ -331,4 +334,4 @@ with gr.Blocks(css=css) as app:
331
  </div>
332
  """)
333
 
334
- app.launch()
 
29
 
30
  if torch.cuda.is_available():
31
  model.to("cuda")
32
+ model.enable_xformers_memory_efficient_attention()
33
 
34
  pipe_inpaint = StableDiffusionInpaintPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, safety_checker=lambda images, **kwargs: (images, False),)
35
  pipe_inpaint.scheduler = DPMSolverMultistepScheduler.from_config(pipe_inpaint.scheduler.config)
 
38
 
39
  if torch.cuda.is_available():
40
  pipe_inpaint = pipe_inpaint.to("cuda")
41
+ pipe.enable_xformers_memory_efficient_attention()
42
 
43
 
44
  def get_init_image(image, overlap, feel):
 
311
  ["typing", "dance beat", "og_beat", 10],
312
  ["synthwave", "jazz", "agile", 10],
313
  ["rap battle freestyle", "", "og_beat", 10],
314
+ # ["techno club banger", "", "og_beat", 10],
315
  ["reggae dub beat", "sunset chill", "og_beat", 10],
316
  ["acoustic folk ballad", "", "agile", 10],
317
  ["blues guitar riff", "", "agile", 5],
 
320
  ["rock and roll power chord", "", "motorway", 5],
321
  ["soulful R&B love song", "", "marim", 10],
322
  ["country western twangy guitar", "", "agile", 10]],
323
+ inputs=[prompt_1, prompt_2, feel, num_iterations].
324
+ cache_examples=True)
325
 
326
  gr.HTML("""
327
  <div style="border-top: 1px solid #303030;">
 
334
  </div>
335
  """)
336
 
337
+ app.queue(max_size=250, concurrency_count=2).launch()