Skip to content

Commit

Permalink
fix deps + tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chainyo committed Oct 2, 2023
1 parent 56166a6 commit cf9c55e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 37 deletions.
24 changes: 10 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,19 @@ classifiers = [
dependencies = [
"aiohttp>=3.8.4",
"aiofiles>=23.1.0",
"ctranslate2>=3.18.0",
"faster-whisper @ git+https://github.com/Wordcab/faster-whisper@master",
"ffmpeg-python>=0.2.0",
"librosa>=0.9.0",
"loguru>=0.6.0",
"numpy==1.23.1",
"onnxruntime>=1.15.0",
"pydantic>=1.10.9",
"python-dotenv>=1.0.0",
"tensorshare>=0.1.1",
"torch>=2.0.0",
"torchaudio>=2.0.1",
"wget>=3.2.0",
"yt-dlp>=2023.3.4",
]

Expand All @@ -48,17 +57,6 @@ path = "src/wordcab_transcribe/__init__.py"
allow-direct-references = true

[project.optional-dependencies]
inference = [
"ctranslate2>=3.18.0",
"faster-whisper @ git+https://github.com/Wordcab/faster-whisper@master",
"librosa>=0.9.0",
"numpy==1.23.1",
"onnxruntime>=1.15.0",
"tensorshare>=0.1.1",
"torch>=2.0.0",
"torchaudio>=2.0.1",
"wget>=3.2.0",
]
runtime = [
"argon2-cffi>=21.3.0",
"fastapi>=0.96.0",
Expand All @@ -68,7 +66,6 @@ runtime = [
"svix>=0.85.1",
"uvicorn>=0.21.1",
"websockets>=11.0.3",
"wordcab_transcribe[inference]",
]
quality = [
"black>=22.10.0",
Expand All @@ -80,9 +77,8 @@ tests = [
"pytest>=7.4",
"pytest-asyncio>=0.21.1",
"pytest-cov>=4.1",
"wordcab_transcribe[inference]",
]
dev = ["wordcab_transcribe[quality,inference,runtime,tests]"]
dev = ["wordcab_transcribe[quality,runtime,tests]"]

[tool.hatch.envs.runtime]
features = [
Expand Down
32 changes: 9 additions & 23 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""Test the models for requests and responses."""

import pytest
from faster_whisper.transcribe import Word

from wordcab_transcribe.models import (
AudioRequest,
Expand All @@ -33,7 +34,6 @@
ProcessTimes,
Timestamps,
Utterance,
Word,
YouTubeResponse,
)

Expand All @@ -59,20 +59,6 @@ def test_timestamps() -> None:
assert Timestamps.hour_minute_second == "hms"


def test_word() -> None:
"""Test the Word model."""
word = Word(
word="test",
start=0.0,
end=1.0,
score=0.9,
)
assert word.word == "test"
assert word.start == 0.0
assert word.end == 1.0
assert word.score == 0.9


def test_utterance() -> None:
"""Test the Utterance model."""
utterance = Utterance(
Expand All @@ -85,25 +71,25 @@ def test_utterance() -> None:
word="This",
start=0.0,
end=1.0,
score=0.9,
probability=0.9,
),
Word(
word="is",
start=1.0,
end=2.0,
score=0.75,
probability=0.75,
),
Word(
word="a",
start=2.0,
end=3.0,
score=0.8,
probability=0.8,
),
Word(
word="test.",
start=3.0,
end=4.0,
score=0.85,
probability=0.85,
),
],
)
Expand All @@ -117,25 +103,25 @@ def test_utterance() -> None:
word="This",
start=0.0,
end=1.0,
score=0.9,
probability=0.9,
),
Word(
word="is",
start=1.0,
end=2.0,
score=0.75,
probability=0.75,
),
Word(
word="a",
start=2.0,
end=3.0,
score=0.8,
probability=0.8,
),
Word(
word="test.",
start=3.0,
end=4.0,
score=0.85,
probability=0.85,
),
]
assert isinstance(utterance.words[0], Word)
Expand Down

0 comments on commit cf9c55e

Please sign in to comment.