-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds insane mode for transcribe anything
- Loading branch information
Showing
8 changed files
with
159 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
Tests transcribe_anything | ||
""" | ||
|
||
# pylint: disable=bad-option-value,useless-option-value,no-self-use,protected-access,R0801 | ||
# flake8: noqa E501 | ||
|
||
import os | ||
import unittest | ||
import shutil | ||
|
||
from transcribe_anything.api import transcribe | ||
|
||
from transcribe_anything.insanely_fast_whisper import has_nvidia_smi | ||
|
||
|
||
HERE = os.path.abspath(os.path.dirname(__file__)) | ||
LOCALFILE_DIR = os.path.join(HERE, "localfile") | ||
TESTS_DATA_DIR = os.path.join(LOCALFILE_DIR, "text_video_api_insane", "en") | ||
|
||
|
||
class InsaneWhisperModeTester(unittest.TestCase): | ||
"""Tester for transcribe anything.""" | ||
|
||
@unittest.skipUnless(has_nvidia_smi(), "No GPU detected") | ||
def test_local_file(self) -> None: | ||
"""Check that the command works on a local file.""" | ||
shutil.rmtree(TESTS_DATA_DIR, ignore_errors=True) | ||
vidfile = os.path.join(LOCALFILE_DIR, "video.mp4") | ||
transcribe( | ||
url_or_file=vidfile, | ||
language="en", | ||
model="tiny", | ||
device="insane", | ||
output_dir=TESTS_DATA_DIR, | ||
) | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters