• Y
  • List All
  • Feedback
    • This Project
    • All Projects
Profile Account settings Log out
  • Favorite
  • Project
  • All
Loading...
  • Log in
  • Sign up
yjyoon / whisper_server_speaches star
  • Project homeH
  • CodeC
  • IssueI
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB
  • Files
  • Commit
  • Branches
whisper_server_speachestestssse_test.py
Download as .zip file
File name
Commit message
Commit date
.github/workflows
update pre-commit deps, replace custom pyright hook
2024-07-03
examples
chore: update docker tag to latest
2024-06-03
faster_whisper_server
fix: models route not returning openai compatible response
2024-07-03
tests
chore: update model(s) route tests
2024-07-03
.dockerignore
chore: ignore .env
2024-05-27
.envrc
init
2024-05-20
.gitattributes
docs: add live-transcription demo
2024-05-28
.gitignore
chore: update .gitignore
2024-07-03
.pre-commit-config.yaml
update pre-commit deps, replace custom pyright hook
2024-07-03
Dockerfile.cpu
fix task enum vals, fix env var parsing, improve gradio, use uv in dockerfile
2024-06-23
Dockerfile.cuda
fix task enum vals, fix env var parsing, improve gradio, use uv in dockerfile
2024-06-23
LICENSE
init
2024-05-20
README.md
Update README.md
2024-06-26
Taskfile.yaml
switch to using uv
2024-07-03
audio.wav
docs: update README.md
2024-05-27
compose.yaml
chore: update docker tag to latest
2024-06-03
flake.lock
init
2024-05-20
flake.nix
switch to using uv
2024-07-03
lsyncd.conf
chore: add lsyncd config
2024-06-03
pyproject.toml
fix: models route not returning openai compatible response
2024-07-03
requirements-all.txt
switch to using uv
2024-07-03
requirements-dev.txt
fix: models route not returning openai compatible response
2024-07-03
requirements.txt
switch to using uv
2024-07-03
File name
Commit message
Commit date
__init__.py
feat: add /v1/models and /v1/model routes #14
2024-06-03
api_model_test.py
chore: update model(s) route tests
2024-07-03
app_test.py
chore: fix ruff errors
2024-07-03
conftest.py
fix: models route not returning openai compatible response
2024-07-03
sse_test.py
chore: fix ruff errors
2024-07-03
Fedir Zadniprovskyi 2024-07-03 b472650 chore: fix ruff errors UNIX
Raw Open in browser Change history
import json import os from fastapi.testclient import TestClient from httpx_sse import connect_sse import pytest from faster_whisper_server.server_models import ( TranscriptionJsonResponse, TranscriptionVerboseJsonResponse, ) FILE_PATHS = ["audio.wav"] # HACK ENDPOINTS = [ "/v1/audio/transcriptions", "/v1/audio/translations", ] parameters = [(file_path, endpoint) for endpoint in ENDPOINTS for file_path in FILE_PATHS] @pytest.mark.parametrize(("file_path", "endpoint"), parameters) def test_streaming_transcription_text(client: TestClient, file_path: str, endpoint: str) -> None: extension = os.path.splitext(file_path)[1] with open(file_path, "rb") as f: data = f.read() kwargs = { "files": {"file": (f"audio.{extension}", data, f"audio/{extension}")}, "data": {"response_format": "text", "stream": True}, } with connect_sse(client, "POST", endpoint, **kwargs) as event_source: for event in event_source.iter_sse(): print(event) assert len(event.data) > 1 # HACK: 1 because of the space character that's always prepended @pytest.mark.parametrize(("file_path", "endpoint"), parameters) def test_streaming_transcription_json(client: TestClient, file_path: str, endpoint: str) -> None: extension = os.path.splitext(file_path)[1] with open(file_path, "rb") as f: data = f.read() kwargs = { "files": {"file": (f"audio.{extension}", data, f"audio/{extension}")}, "data": {"response_format": "json", "stream": True}, } with connect_sse(client, "POST", endpoint, **kwargs) as event_source: for event in event_source.iter_sse(): TranscriptionJsonResponse(**json.loads(event.data)) @pytest.mark.parametrize(("file_path", "endpoint"), parameters) def test_streaming_transcription_verbose_json(client: TestClient, file_path: str, endpoint: str) -> None: extension = os.path.splitext(file_path)[1] with open(file_path, "rb") as f: data = f.read() kwargs = { "files": {"file": (f"audio.{extension}", data, f"audio/{extension}")}, "data": {"response_format": "verbose_json", "stream": True}, } with connect_sse(client, "POST", endpoint, **kwargs) as event_source: for event in event_source.iter_sse(): TranscriptionVerboseJsonResponse(**json.loads(event.data))

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
Sign in with github login with Google Sign in with Google
Reset password | Sign up