Skip to content

Audio completion version 2#44

Open
Skriller18 wants to merge 6 commits intomasterfrom
voice-continuation
Open

Audio completion version 2#44
Skriller18 wants to merge 6 commits intomasterfrom
voice-continuation

Conversation

@Skriller18
Copy link
Copy Markdown
Collaborator

  • Added voice continuation version 2

Comment thread service/inference.py Outdated
from .db.feedback import RealFakeFeedbackDB

#Imports for audio_completion_v2
from openai import OpenAI
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this above L#15

Comment thread service/inference.py
global whisper_model
whisper_model = whisper.load_model("small")

OpenAI.api_key = os.getenv("OPENAI_API_KEY")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Ref: https://pypi.org/project/python-dotenv/

Comment thread service/inference.py Outdated
start_time = time.time()

try:
# 1. Validate file type
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for these types of comments. Comments should ideally not be about What, rather Why

Comment thread service/inference.py Outdated
Comment thread service/inference.py Outdated
elif audio.dim() == 1:
audio = audio.unsqueeze(0) # Add batch dimension if missing

# Convert to mono if stereo
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already done in L#215, no?

Comment thread service/inference.py Outdated

#Imports for audio_completion_v2
from openai import OpenAI
import whisper
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add these to requirements.txt as well

Comment thread service/inference.py
metrics: TTSMetrics = results.audio_metrics
audio_tensor = torch.from_numpy(results.audio)

if audio_tensor.dim() == 1:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this

Comment thread service/inference.py Outdated
- Removed comments
- Changed imports
- Removed byte buffer
Added whisper and openai packages
Truncated the first 5 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants