-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unnecessary directories during workflow execution
- Loading branch information
1 parent
b31c02a
commit 3cefccc
Showing
9 changed files
with
677 additions
and
657 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,13 @@ | ||
import os | ||
|
||
from openai import OpenAI | ||
|
||
|
||
def openai_speech_to_text(audio_file_path): | ||
client = OpenAI(base_url=os.environ["OPENAI_API_BASE"], api_key=os.environ["OPENAI_API_KEY"]) | ||
audio_file = open(audio_file_path, "rb") | ||
transcription = client.audio.transcriptions.create( | ||
model="whisper-1", | ||
file=audio_file | ||
) | ||
print(transcription.text) |
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
Empty file.
Empty file.
Empty file.
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,15 @@ | ||
import unittest | ||
from unittest import TestCase | ||
|
||
from langchain_lab.core.audio import openai_speech_to_text | ||
|
||
|
||
class TestAudio(TestCase): | ||
|
||
@unittest.skip("Skip test_transcriptions") | ||
def test_transcriptions(self): | ||
openai_speech_to_text("input.wav") | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |