make project relaease ready
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
[metadata]
|
||||
name = scraibe
|
||||
version = attr: scraibe.__version__
|
||||
author = Jacob Schmieder
|
||||
author_email = Jacob.Schmieder@dbfz.de
|
||||
description = My package description
|
||||
long_description = file: README.md, LICENSE
|
||||
platforms = Linux
|
||||
keywords = transcription speech recognition whisper pyannote audio speech-to-text speech-to-text transcription speech-to-text recognition voice-to-speech
|
||||
license = GPL-3.0
|
||||
classifiers =
|
||||
Development Status :: 3 - Alpha
|
||||
Environment :: GPU :: NVIDIA CUDA :: 11.2
|
||||
License :: OSI Approved :: Open Software License 3.0 (OSL-3.0)
|
||||
Topic :: Scientific/Engineering :: Artificial Intelligence
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Python :: 3.10
|
||||
|
||||
[options]
|
||||
zip_safe = False
|
||||
include_package_data = True
|
||||
packages = find:
|
||||
python_requires = >=3.7
|
||||
install_requires =
|
||||
requests
|
||||
importlib-metadata; python_version<"3.8"
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
executable-name = scraibe.cli:cli
|
||||
@@ -1,3 +1,4 @@
|
||||
from calendar import c
|
||||
import pkg_resources
|
||||
import os
|
||||
from setuptools import setup, find_packages
|
||||
@@ -36,11 +37,24 @@ if __name__ == "__main__":
|
||||
'https://download.pytorch.org/whl/cu113',
|
||||
],
|
||||
url= github_url,
|
||||
license='',
|
||||
|
||||
license='GPL-3',
|
||||
author='Jacob Schmieder',
|
||||
author_email='Jacob.Schmieder@dbfz.de',
|
||||
description='Transcription tool for audio files based on Whisper and Pyannote',
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Environment :: GPU :: NVIDIA CUDA :: 11.2',
|
||||
'License :: OSI Approved :: Open Software License 3.0 (OSL-3.0)',
|
||||
'Topic :: Scientific/Engineering :: Artificial Intelligence',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
'Programming Language :: Python :: 3.10'],
|
||||
keywords = ['transcription', 'speech recognition', 'whisper', 'pyannote', 'audio',
|
||||
'speech-to-text', 'speech-to-text transcription', 'speech-to-text recognition',
|
||||
'voice-to-speech'],
|
||||
package_data={ "header" : ["app/header.html"], "logo" : ["app/Logo_KIDA_bmel_green.svg"]},
|
||||
entry_points={'console_scripts':
|
||||
['scraibe = scraibe.cli:cli']}
|
||||
|
||||
)
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
import pytest
|
||||
from scraibe import Transcriber
|
||||
from unittest.mock import patch, mock_open
|
||||
import os
|
||||
|
||||
def test_load_pyannote_model():
|
||||
"""
|
||||
Test load_pyannote_test
|
||||
"""
|
||||
from pyannote.audio.pipelines.speaker_diarization import SpeakerDiarization
|
||||
from pyannote.audio import Pipeline
|
||||
|
||||
pipeline = Pipeline.from_pretrained("models/pyannote/speaker_diarization/config.yaml")
|
||||
assert isinstance(pipeline, SpeakerDiarization)
|
||||
|
||||
# Test Transcribtion class
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def transcriber():
|
||||
"""
|
||||
Prepare Transcriber for testing
|
||||
Returns: Transcriber Object
|
||||
"""
|
||||
|
||||
return Transcriber.load_model("medium", local=True)
|
||||
|
||||
|
||||
def test_Transcriber_init(transcriber):
|
||||
"""
|
||||
Test Transcriber initialization with a whisper model
|
||||
"""
|
||||
|
||||
assert isinstance(transcriber, Transcriber)
|
||||
|
||||
def test_transcription(transcriber):
|
||||
"""
|
||||
Test transcription
|
||||
"""
|
||||
|
||||
transcript = transcriber.transcribe("tests/test.wav")
|
||||
assert isinstance(transcript, str)
|
||||
|
||||
def test_save_transcript_to_file(transcriber):
|
||||
"""
|
||||
Test save_transcript_to_file
|
||||
"""
|
||||
transcript = transcriber.transcribe("tests/test.wav")
|
||||
|
||||
Transcriber.save_transcript(transcript, "tests/output.txt")
|
||||
|
||||
assert os.path.exists("tests/output.txt")
|
||||
|
||||
os.remove("tests/output.txt")
|
||||
|
||||
# Test Diaraization class
|
||||
|
||||
from scraibe import Diariser
|
||||
|
||||
@pytest.fixture
|
||||
def diarisation():
|
||||
"""
|
||||
Prepare Diarisation for testing
|
||||
Returns: Diarisation Object
|
||||
"""
|
||||
|
||||
return Diariser.load_model("models/pyannote/speaker_diarization/config.yaml", local=True)
|
||||
|
||||
def test_Diarisation_init(diarisation):
|
||||
"""
|
||||
Test Diarisation initialization with a pyannote model
|
||||
"""
|
||||
|
||||
assert isinstance(diarisation, Diariser)
|
||||
|
||||
def test_diarisation(diarisation):
|
||||
"""
|
||||
Test diarisation
|
||||
"""
|
||||
|
||||
diarisation = diarisation.diarization("tests/test.wav")
|
||||
assert isinstance(diarisation, dict)
|
||||
|
||||
# Test AudioProcessor
|
||||
|
||||
from scraibe import AudioProcessor , TorchAudioProcessor
|
||||
|
||||
|
||||
def test_AudioProcessor_init():
|
||||
"""
|
||||
Test AudioProcessor initialization
|
||||
"""
|
||||
audio = AudioProcessor("tests/test.wav")
|
||||
assert isinstance(audio, AudioProcessor)
|
||||
|
||||
def test_AudioProcessor_convert():
|
||||
"""
|
||||
Test AudioProcessor convert
|
||||
"""
|
||||
audio = AudioProcessor("tests/test.wav")
|
||||
audio.convert_audio("tests/test.mp3", format="mp3")
|
||||
assert os.path.exists("tests/test.mp3")
|
||||
|
||||
def test_TorchAudioProcessor_from_file():
|
||||
"""
|
||||
Test TorchAudioProcessor initialization
|
||||
"""
|
||||
audio = TorchAudioProcessor.from_file("tests/test.wav")
|
||||
|
||||
assert isinstance(audio, TorchAudioProcessor)
|
||||
|
||||
os.remove("tests/test.mp3")
|
||||
|
||||
|
||||
def test_TorchAudioProcessor_from_ffmpeg():
|
||||
"""
|
||||
Test TorchAudioProcessor initialization
|
||||
"""
|
||||
audio = TorchAudioProcessor.from_ffmpeg("tests/test.wav")
|
||||
assert isinstance(audio, TorchAudioProcessor)
|
||||
Reference in New Issue
Block a user