Spaces:
Sleeping
Sleeping
Add concurrency count to app.py. Set this to 1 by default.
Browse filesThis is to ensure that the WebUI is accessible from within proxies.
- app.py +6 -0
- config.json5 +2 -0
- src/config.py +3 -1
app.py
CHANGED
@@ -423,6 +423,10 @@ def create_ui(app_config: ApplicationConfig):
|
|
423 |
|
424 |
demo = gr.TabbedInterface([simple_transcribe, full_transcribe], tab_names=["Simple", "Full"])
|
425 |
|
|
|
|
|
|
|
|
|
426 |
demo.launch(share=app_config.share, server_name=app_config.server_name, server_port=app_config.server_port)
|
427 |
|
428 |
# Clean up
|
@@ -441,6 +445,8 @@ if __name__ == '__main__':
|
|
441 |
help="The host or IP to bind to. If None, bind to localhost.") # None
|
442 |
parser.add_argument("--server_port", type=int, default=app_config.server_port, \
|
443 |
help="The port to bind to.") # 7860
|
|
|
|
|
444 |
parser.add_argument("--default_model_name", type=str, choices=whisper_models, default=app_config.default_model_name, \
|
445 |
help="The default model name.") # medium
|
446 |
parser.add_argument("--default_vad", type=str, default=app_config.default_vad, \
|
|
|
423 |
|
424 |
demo = gr.TabbedInterface([simple_transcribe, full_transcribe], tab_names=["Simple", "Full"])
|
425 |
|
426 |
+
# Queue up the demo
|
427 |
+
if app_config.queue_concurrency_count is not None and app_config.queue_concurrency_count > 0:
|
428 |
+
demo.queue(concurrency_count=app_config.queue_concurrency_count)
|
429 |
+
|
430 |
demo.launch(share=app_config.share, server_name=app_config.server_name, server_port=app_config.server_port)
|
431 |
|
432 |
# Clean up
|
|
|
445 |
help="The host or IP to bind to. If None, bind to localhost.") # None
|
446 |
parser.add_argument("--server_port", type=int, default=app_config.server_port, \
|
447 |
help="The port to bind to.") # 7860
|
448 |
+
parser.add_argument("--queue_concurrency_count", type=int, default=app_config.queue_concurrency_count, \
|
449 |
+
help="The number of concurrent requests to process.") # 1
|
450 |
parser.add_argument("--default_model_name", type=str, choices=whisper_models, default=app_config.default_model_name, \
|
451 |
help="The default model name.") # medium
|
452 |
parser.add_argument("--default_vad", type=str, default=app_config.default_vad, \
|
config.json5
CHANGED
@@ -55,6 +55,8 @@
|
|
55 |
"server_name": null,
|
56 |
// The port to bind to.
|
57 |
"server_port": 7860,
|
|
|
|
|
58 |
// Whether or not to automatically delete all uploaded files, to save disk space
|
59 |
"delete_uploaded_files": true,
|
60 |
|
|
|
55 |
"server_name": null,
|
56 |
// The port to bind to.
|
57 |
"server_port": 7860,
|
58 |
+
// The number of workers to use for the web server. Use -1 to disable queueing.
|
59 |
+
"queue_concurrency_count": 1,
|
60 |
// Whether or not to automatically delete all uploaded files, to save disk space
|
61 |
"delete_uploaded_files": true,
|
62 |
|
src/config.py
CHANGED
@@ -103,7 +103,8 @@ class ModelConfig:
|
|
103 |
|
104 |
class ApplicationConfig:
|
105 |
def __init__(self, models: List[ModelConfig] = [], input_audio_max_duration: int = 600,
|
106 |
-
share: bool = False, server_name: str = None, server_port: int = 7860,
|
|
|
107 |
default_model_name: str = "medium", default_vad: str = "silero-vad",
|
108 |
vad_parallel_devices: str = "", vad_cpu_cores: int = 1, vad_process_timeout: int = 1800,
|
109 |
auto_parallel: bool = False, output_dir: str = None,
|
@@ -128,6 +129,7 @@ class ApplicationConfig:
|
|
128 |
self.share = share
|
129 |
self.server_name = server_name
|
130 |
self.server_port = server_port
|
|
|
131 |
self.delete_uploaded_files = delete_uploaded_files
|
132 |
|
133 |
self.default_model_name = default_model_name
|
|
|
103 |
|
104 |
class ApplicationConfig:
|
105 |
def __init__(self, models: List[ModelConfig] = [], input_audio_max_duration: int = 600,
|
106 |
+
share: bool = False, server_name: str = None, server_port: int = 7860,
|
107 |
+
queue_concurrency_count: int = 1, delete_uploaded_files: bool = True,
|
108 |
default_model_name: str = "medium", default_vad: str = "silero-vad",
|
109 |
vad_parallel_devices: str = "", vad_cpu_cores: int = 1, vad_process_timeout: int = 1800,
|
110 |
auto_parallel: bool = False, output_dir: str = None,
|
|
|
129 |
self.share = share
|
130 |
self.server_name = server_name
|
131 |
self.server_port = server_port
|
132 |
+
self.queue_concurrency_count = queue_concurrency_count
|
133 |
self.delete_uploaded_files = delete_uploaded_files
|
134 |
|
135 |
self.default_model_name = default_model_name
|