Audio completion version 2#44
Open
Skriller18 wants to merge 6 commits intomasterfrom
Open
Conversation
Collaborator
Skriller18
commented
Nov 19, 2024
- Added voice continuation version 2
romitjain
reviewed
Nov 20, 2024
| from .db.feedback import RealFakeFeedbackDB | ||
|
|
||
| #Imports for audio_completion_v2 | ||
| from openai import OpenAI |
| global whisper_model | ||
| whisper_model = whisper.load_model("small") | ||
|
|
||
| OpenAI.api_key = os.getenv("OPENAI_API_KEY") |
Contributor
There was a problem hiding this comment.
An easier way is to store the environment variables in a .env file and use load_dotenv() to make all the environment variables available to the program.
| start_time = time.time() | ||
|
|
||
| try: | ||
| # 1. Validate file type |
Contributor
There was a problem hiding this comment.
No need for these types of comments. Comments should ideally not be about What, rather Why
| elif audio.dim() == 1: | ||
| audio = audio.unsqueeze(0) # Add batch dimension if missing | ||
|
|
||
| # Convert to mono if stereo |
Contributor
There was a problem hiding this comment.
This is already done in L#215, no?
|
|
||
| #Imports for audio_completion_v2 | ||
| from openai import OpenAI | ||
| import whisper |
Contributor
There was a problem hiding this comment.
Add these to requirements.txt as well
| metrics: TTSMetrics = results.audio_metrics | ||
| audio_tensor = torch.from_numpy(results.audio) | ||
|
|
||
| if audio_tensor.dim() == 1: |
- Removed comments - Changed imports - Removed byte buffer
Added whisper and openai packages
Truncated the first 5 seconds
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.