

feat: add flag to disable/enable ui
@29f0e9733d1e91dd50242bc505617e79b501d5b1
--- faster_whisper_server/config.py
+++ faster_whisper_server/config.py
... | ... | @@ -198,6 +198,11 @@ |
198 | 198 |
host: str = Field(alias="UVICORN_HOST", default="0.0.0.0") |
199 | 199 |
port: int = Field(alias="UVICORN_PORT", default=8000) |
200 | 200 |
|
201 |
+ enable_ui: bool = True |
|
202 |
+ """ |
|
203 |
+ Whether to enable the Gradio UI. You may want to disable this if you want to minimize the dependencies. |
|
204 |
+ """ |
|
205 |
+ |
|
201 | 206 |
default_language: Language | None = None |
202 | 207 |
default_response_format: ResponseFormat = ResponseFormat.JSON |
203 | 208 |
whisper: WhisperConfig = WhisperConfig() |
--- faster_whisper_server/main.py
+++ faster_whisper_server/main.py
... | ... | @@ -21,7 +21,6 @@ |
21 | 21 |
from fastapi.websockets import WebSocketState |
22 | 22 |
from faster_whisper import WhisperModel |
23 | 23 |
from faster_whisper.vad import VadOptions, get_speech_timestamps |
24 |
-import gradio as gr |
|
25 | 24 |
import huggingface_hub |
26 | 25 |
from pydantic import AfterValidator |
27 | 26 |
|
... | ... | @@ -35,7 +34,6 @@ |
35 | 34 |
Task, |
36 | 35 |
config, |
37 | 36 |
) |
38 |
-from faster_whisper_server.gradio_app import create_gradio_demo |
|
39 | 37 |
from faster_whisper_server.logger import logger |
40 | 38 |
from faster_whisper_server.server_models import ( |
41 | 39 |
ModelListResponse, |
... | ... | @@ -334,4 +332,9 @@ |
334 | 332 |
await ws.close() |
335 | 333 |
|
336 | 334 |
|
337 |
-app = gr.mount_gradio_app(app, create_gradio_demo(config), path="/") |
|
335 |
+if config.enable_ui: |
|
336 |
+ import gradio as gr |
|
337 |
+ |
|
338 |
+ from faster_whisper_server.gradio_app import create_gradio_demo |
|
339 |
+ |
|
340 |
+ app = gr.mount_gradio_app(app, create_gradio_demo(config), path="/") |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?