Skip to content

Commit

Permalink
Update server config
Browse files Browse the repository at this point in the history
  • Loading branch information
jhj0517 committed Nov 19, 2024
1 parent 912d16e commit 6b34bab
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions backend/tests/test_backend_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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):
Expand All @@ -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:
Expand Down

0 comments on commit 6b34bab

Please sign in to comment.