From 6b34bab01ead77d6f74ae30c5feb60a866a8e41e Mon Sep 17 00:00:00 2001 From: jhj0517 <97279763+jhj0517@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:37:07 +0900 Subject: [PATCH] Update server config --- backend/tests/test_backend_config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/tests/test_backend_config.py b/backend/tests/test_backend_config.py index fcb180e..329339f 100644 --- a/backend/tests/test_backend_config.py +++ b/backend/tests/test_backend_config.py @@ -6,10 +6,12 @@ import os import requests import pytest +import yaml from backend.main import backend_app from modules.whisper.data_classes import * from modules.utils.paths import * +from modules.utils.files_manager import load_yaml, save_yaml TEST_PIPELINE_PARAMS = {**WhisperParams(model_size="tiny").model_dump(exclude_none=True), **VadParams().model_dump(exclude_none=True), @@ -19,9 +21,12 @@ TEST_BGM_SEPARATION_PARAMS = BGMSeparationParams() TEST_FILE_DOWNLOAD_URL = "https://github.com/jhj0517/whisper_flutter_new/raw/main/example/assets/jfk.wav" TEST_FILE_PATH = os.path.join(WEBUI_DIR, "backend", "tests", "jfk.wav") +TEST_WHISPER_MODEL = "tiny" +TEST_COMPUTE_TYPE = "float32" @pytest.fixture(autouse=True) +@functools.lru_cache def setup_test_file(): def download_file(url=TEST_FILE_DOWNLOAD_URL, file_path=TEST_FILE_PATH): if os.path.exists(file_path): @@ -39,6 +44,11 @@ def download_file(url=TEST_FILE_DOWNLOAD_URL, file_path=TEST_FILE_PATH): download_file(TEST_FILE_DOWNLOAD_URL, TEST_FILE_PATH) + server_config = load_yaml(SERVER_CONFIG_PATH) + server_config["whisper"]["model_size"] = TEST_WHISPER_MODEL + server_config["whisper"]["compute_type"] = TEST_COMPUTE_TYPE + save_yaml(server_config, SERVER_CONFIG_PATH) + @pytest.fixture def upload_file_instance(filepath: str = TEST_FILE_PATH) -> UploadFile: