fix remote whisper tests (#5732)

This commit is contained in:
ZanSara 2023-09-07 09:53:29 +01:00 committed by GitHub
parent 42b6954aa5
commit 7abd73419f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -4,13 +4,14 @@ from haystack.preview.components.audio.whisper_local import LocalWhisperTranscri
def test_whisper_local_transcriber(preview_samples_path):
comp = LocalWhisperTranscriber(model_name_or_path="medium")
comp.warm_up()
docs = comp.transcribe(
output = comp.run(
audio_files=[
preview_samples_path / "audio" / "this is the content of the document.wav",
str((preview_samples_path / "audio" / "the context for this answer is here.wav").absolute()),
open(preview_samples_path / "audio" / "answer.wav", "rb"),
]
)
docs = output["documents"]
assert len(docs) == 3
assert "this is the content of the document." == docs[0].content.strip().lower()

View File

@ -13,15 +13,13 @@ def test_whisper_remote_transcriber(preview_samples_path):
comp = RemoteWhisperTranscriber(api_key=os.environ.get("OPENAI_API_KEY"))
output = comp.run(
RemoteWhisperTranscriber.Input(
audio_files=[
preview_samples_path / "audio" / "this is the content of the document.wav",
str((preview_samples_path / "audio" / "the context for this answer is here.wav").absolute()),
open(preview_samples_path / "audio" / "answer.wav", "rb"),
]
)
audio_files=[
preview_samples_path / "audio" / "this is the content of the document.wav",
str((preview_samples_path / "audio" / "the context for this answer is here.wav").absolute()),
open(preview_samples_path / "audio" / "answer.wav", "rb"),
]
)
docs = output.documents
docs = output["documents"]
assert len(docs) == 3
assert "this is the content of the document." == docs[0].content.strip().lower()