Spaces:
Running
Running
Adding support for setting server root
Browse files- app.py +3 -1
- config.json5 +4 -0
- src/config.py +3 -1
app.py
CHANGED
|
@@ -715,7 +715,7 @@ def create_ui(app_config: ApplicationConfig):
|
|
| 715 |
else:
|
| 716 |
print("Queue mode disabled - progress bars will not be shown.")
|
| 717 |
|
| 718 |
-
demo.launch(share=app_config.share, server_name=app_config.server_name, server_port=app_config.server_port)
|
| 719 |
|
| 720 |
# Clean up
|
| 721 |
ui.close()
|
|
@@ -736,6 +736,8 @@ if __name__ == '__main__':
|
|
| 736 |
help="The host or IP to bind to. If None, bind to localhost.") # None
|
| 737 |
parser.add_argument("--server_port", type=int, default=default_app_config.server_port, \
|
| 738 |
help="The port to bind to.") # 7860
|
|
|
|
|
|
|
| 739 |
parser.add_argument("--queue_concurrency_count", type=int, default=default_app_config.queue_concurrency_count, \
|
| 740 |
help="The number of concurrent requests to process.") # 1
|
| 741 |
parser.add_argument("--default_model_name", "--model", type=str, choices=whisper_models, default=default_app_config.default_model_name, \
|
|
|
|
| 715 |
else:
|
| 716 |
print("Queue mode disabled - progress bars will not be shown.")
|
| 717 |
|
| 718 |
+
demo.launch(share=app_config.share, server_name=app_config.server_name, server_port=app_config.server_port, root_path=app_config.server_root)
|
| 719 |
|
| 720 |
# Clean up
|
| 721 |
ui.close()
|
|
|
|
| 736 |
help="The host or IP to bind to. If None, bind to localhost.") # None
|
| 737 |
parser.add_argument("--server_port", type=int, default=default_app_config.server_port, \
|
| 738 |
help="The port to bind to.") # 7860
|
| 739 |
+
parser.add_argument("--server_root", type=str, default=default_app_config.server_root, \
|
| 740 |
+
help="The root path to bind to.") # Empty
|
| 741 |
parser.add_argument("--queue_concurrency_count", type=int, default=default_app_config.queue_concurrency_count, \
|
| 742 |
help="The number of concurrent requests to process.") # 1
|
| 743 |
parser.add_argument("--default_model_name", "--model", type=str, choices=whisper_models, default=default_app_config.default_model_name, \
|
config.json5
CHANGED
|
@@ -63,6 +63,10 @@
|
|
| 63 |
"server_name": null,
|
| 64 |
// The port to bind to.
|
| 65 |
"server_port": 7860,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
// The number of workers to use for the web server. Use -1 to disable queueing.
|
| 67 |
"queue_concurrency_count": 1,
|
| 68 |
// Whether or not to automatically delete all uploaded files, to save disk space
|
|
|
|
| 63 |
"server_name": null,
|
| 64 |
// The port to bind to.
|
| 65 |
"server_port": 7860,
|
| 66 |
+
// The root path (or "mount point") of the application, if it's not served from the root ("/") of the domain.
|
| 67 |
+
// Often used when the application is behind a reverse proxy that forwards requests to the application.
|
| 68 |
+
// For example, if the application is served at "https://example.com/myapp", the `root_path` should be set to "/myapp".
|
| 69 |
+
"server_root": "",
|
| 70 |
// The number of workers to use for the web server. Use -1 to disable queueing.
|
| 71 |
"queue_concurrency_count": 1,
|
| 72 |
// Whether or not to automatically delete all uploaded files, to save disk space
|
src/config.py
CHANGED
|
@@ -48,7 +48,8 @@ class VadInitialPromptMode(Enum):
|
|
| 48 |
|
| 49 |
class ApplicationConfig:
|
| 50 |
def __init__(self, models: List[ModelConfig] = [], input_audio_max_duration: int = 600,
|
| 51 |
-
share: bool = False,
|
|
|
|
| 52 |
queue_concurrency_count: int = 1, delete_uploaded_files: bool = True,
|
| 53 |
whisper_implementation: str = "whisper",
|
| 54 |
default_model_name: str = "medium", default_vad: str = "silero-vad",
|
|
@@ -82,6 +83,7 @@ class ApplicationConfig:
|
|
| 82 |
self.share = share
|
| 83 |
self.server_name = server_name
|
| 84 |
self.server_port = server_port
|
|
|
|
| 85 |
self.queue_concurrency_count = queue_concurrency_count
|
| 86 |
self.delete_uploaded_files = delete_uploaded_files
|
| 87 |
|
|
|
|
| 48 |
|
| 49 |
class ApplicationConfig:
|
| 50 |
def __init__(self, models: List[ModelConfig] = [], input_audio_max_duration: int = 600,
|
| 51 |
+
share: bool = False,
|
| 52 |
+
server_name: str = None, server_port: int = 7860, server_root: str = "",
|
| 53 |
queue_concurrency_count: int = 1, delete_uploaded_files: bool = True,
|
| 54 |
whisper_implementation: str = "whisper",
|
| 55 |
default_model_name: str = "medium", default_vad: str = "silero-vad",
|
|
|
|
| 83 |
self.share = share
|
| 84 |
self.server_name = server_name
|
| 85 |
self.server_port = server_port
|
| 86 |
+
self.server_root = server_root
|
| 87 |
self.queue_concurrency_count = queue_concurrency_count
|
| 88 |
self.delete_uploaded_files = delete_uploaded_files
|
| 89 |
|