-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* whisper model support correctly * Improve log file conversion performance * fix pytest
- Loading branch information
Showing
14 changed files
with
137 additions
and
110 deletions.
There are no files selected for viewing
Binary file not shown.
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,12 @@ | ||
import openai | ||
|
||
openai.api_base = "https://api.openai-forward.com/v1" | ||
openai.api_key = "sk-******" | ||
|
||
resp = openai.ChatCompletion.create( | ||
model="gpt-3.5-turbo", | ||
messages=[ | ||
{"role": "user", "content": "Who won the world series in 2020?"}, | ||
], | ||
) | ||
print(resp.choices) |
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,9 @@ | ||
import openai | ||
|
||
openai.api_base = "http://localhost:8000/v1" | ||
openai.api_key = "sk-******" | ||
response = openai.Embedding.create( | ||
input="Your text string goes here", model="text-embedding-ada-002" | ||
) | ||
embeddings = response['data'][0]['embedding'] | ||
print(embeddings) |
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,10 @@ | ||
# Note: you need to be using OpenAI Python v0.27.0 for the code below to work | ||
import openai | ||
from sparrow import relp | ||
|
||
openai.api_base = "https://api.openai-forward.com/v1" | ||
openai.api_key = "sk-******" | ||
|
||
audio_file = open(relp("../.github/data/whisper.m4a"), "rb") | ||
transcript = openai.Audio.transcribe("whisper-1", audio_file) | ||
print(transcript) |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = "0.2.4" | ||
__version__ = "0.3.0-alpha" | ||
|
||
from dotenv import load_dotenv | ||
|
||
|
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
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,10 @@ | ||
from loguru import logger | ||
|
||
|
||
class WhisperSaver: | ||
def __init__(self): | ||
self.logger = logger.bind(whisper=True) | ||
|
||
def add_log(self, bytes_: bytes): | ||
text_content = bytes_.decode("utf-8") | ||
self.logger.debug(text_content) |
Oops, something went wrong.