Khushi Dahiya commited on
Commit
2ff3e07
·
1 Parent(s): f568365

fixing gradio issues

Browse files
Files changed (1) hide show
  1. demos/melodyflow_app.py +11 -6
demos/melodyflow_app.py CHANGED
@@ -4,6 +4,11 @@
4
  # This source code is licensed under the license found in the
5
  # LICENSE file in the root directory of this source tree.
6
 
 
 
 
 
 
7
  import spaces
8
  import argparse
9
  import logging
@@ -536,7 +541,8 @@ def ui_local(launch_kwargs):
536
  duration,
537
  melody,
538
  model_path,],
539
- outputs=[o for o in audio_outputs])
 
540
  melody.change(toggle_melody, melody, [solver])
541
  solver.change(toggle_solver, [solver, melody], [steps, target_flowstep,
542
  regularize, regularization_strength, duration])
@@ -599,10 +605,9 @@ def ui_local(launch_kwargs):
599
  )
600
 
601
  interface.queue(
602
- concurrency_count=8, # Allow up to 8 concurrent requests
603
  max_size=50, # Queue up to 50 requests
604
  api_open=True # Enable API access
605
- ).launch(**launch_kwargs)
606
 
607
  def ui_hf(launch_kwargs):
608
  with gr.Blocks() as interface:
@@ -658,7 +663,8 @@ def ui_hf(launch_kwargs):
658
  regularization_strength,
659
  duration,
660
  melody,],
661
- outputs=[o for o in audio_outputs])
 
662
  melody.change(toggle_melody, melody, [solver])
663
  solver.change(toggle_solver, [solver, melody], [steps, target_flowstep,
664
  regularize, regularization_strength, duration])
@@ -720,10 +726,9 @@ def ui_hf(launch_kwargs):
720
  """)
721
 
722
  interface.queue(
723
- concurrency_count=8, # Allow up to 8 concurrent requests
724
  max_size=50, # Queue up to 50 requests
725
  api_open=True # Enable API access
726
- ).launch(**launch_kwargs)
727
 
728
 
729
  def cleanup():
 
4
  # This source code is licensed under the license found in the
5
  # LICENSE file in the root directory of this source tree.
6
 
7
+ import os
8
+ # Fix OpenMP threading issues
9
+ os.environ.setdefault('OMP_NUM_THREADS', '1')
10
+ os.environ.setdefault('MKL_NUM_THREADS', '1')
11
+
12
  import spaces
13
  import argparse
14
  import logging
 
541
  duration,
542
  melody,
543
  model_path,],
544
+ outputs=[o for o in audio_outputs],
545
+ concurrency_limit=8) # Set concurrency limit on the event listener
546
  melody.change(toggle_melody, melody, [solver])
547
  solver.change(toggle_solver, [solver, melody], [steps, target_flowstep,
548
  regularize, regularization_strength, duration])
 
605
  )
606
 
607
  interface.queue(
 
608
  max_size=50, # Queue up to 50 requests
609
  api_open=True # Enable API access
610
+ ).launch(max_threads=16, **launch_kwargs) # Configure worker threads in launch()
611
 
612
  def ui_hf(launch_kwargs):
613
  with gr.Blocks() as interface:
 
663
  regularization_strength,
664
  duration,
665
  melody,],
666
+ outputs=[o for o in audio_outputs],
667
+ concurrency_limit=8) # Set concurrency limit on the event listener
668
  melody.change(toggle_melody, melody, [solver])
669
  solver.change(toggle_solver, [solver, melody], [steps, target_flowstep,
670
  regularize, regularization_strength, duration])
 
726
  """)
727
 
728
  interface.queue(
 
729
  max_size=50, # Queue up to 50 requests
730
  api_open=True # Enable API access
731
+ ).launch(max_threads=16, **launch_kwargs) # Configure worker threads in launch()
732
 
733
 
734
  def cleanup():