Spaces:
Configuration error
Configuration error
Fedir Zadniprovskyi
commited on
Commit
·
4e64465
1
Parent(s):
fa8a19e
feat: add flag to disable/enable ui
Browse files
faster_whisper_server/config.py
CHANGED
@@ -198,6 +198,11 @@ class Config(BaseSettings):
|
|
198 |
host: str = Field(alias="UVICORN_HOST", default="0.0.0.0")
|
199 |
port: int = Field(alias="UVICORN_PORT", default=8000)
|
200 |
|
|
|
|
|
|
|
|
|
|
|
201 |
default_language: Language | None = None
|
202 |
default_response_format: ResponseFormat = ResponseFormat.JSON
|
203 |
whisper: WhisperConfig = WhisperConfig()
|
|
|
198 |
host: str = Field(alias="UVICORN_HOST", default="0.0.0.0")
|
199 |
port: int = Field(alias="UVICORN_PORT", default=8000)
|
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 |
+
|
206 |
default_language: Language | None = None
|
207 |
default_response_format: ResponseFormat = ResponseFormat.JSON
|
208 |
whisper: WhisperConfig = WhisperConfig()
|
faster_whisper_server/main.py
CHANGED
@@ -21,7 +21,6 @@ from fastapi.responses import StreamingResponse
|
|
21 |
from fastapi.websockets import WebSocketState
|
22 |
from faster_whisper import WhisperModel
|
23 |
from faster_whisper.vad import VadOptions, get_speech_timestamps
|
24 |
-
import gradio as gr
|
25 |
import huggingface_hub
|
26 |
from pydantic import AfterValidator
|
27 |
|
@@ -35,7 +34,6 @@ from faster_whisper_server.config import (
|
|
35 |
Task,
|
36 |
config,
|
37 |
)
|
38 |
-
from faster_whisper_server.gradio_app import create_gradio_demo
|
39 |
from faster_whisper_server.logger import logger
|
40 |
from faster_whisper_server.server_models import (
|
41 |
ModelListResponse,
|
@@ -334,4 +332,9 @@ async def transcribe_stream(
|
|
334 |
await ws.close()
|
335 |
|
336 |
|
337 |
-
|
|
|
|
|
|
|
|
|
|
|
|
21 |
from fastapi.websockets import WebSocketState
|
22 |
from faster_whisper import WhisperModel
|
23 |
from faster_whisper.vad import VadOptions, get_speech_timestamps
|
|
|
24 |
import huggingface_hub
|
25 |
from pydantic import AfterValidator
|
26 |
|
|
|
34 |
Task,
|
35 |
config,
|
36 |
)
|
|
|
37 |
from faster_whisper_server.logger import logger
|
38 |
from faster_whisper_server.server_models import (
|
39 |
ModelListResponse,
|
|
|
332 |
await ws.close()
|
333 |
|
334 |
|
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="/")
|