Update ElevenLabs API Integration, Enhance Security, and Improve Narrator Functionality#53
Open
mgennings wants to merge 4 commits intocbh123:mainfrom
Open
Update ElevenLabs API Integration, Enhance Security, and Improve Narrator Functionality#53mgennings wants to merge 4 commits intocbh123:mainfrom
mgennings wants to merge 4 commits intocbh123:mainfrom
Conversation
…ironment variables
…ates This commit addresses changes made to update the ElevenLabs API version as per pull request cbh123#51 (Update narrator.py to reflect API updates cbh123#51 - cbh123#51). The following changes have been made: narrator.py: - Updated the ElevenLabs client instantiation to the new API format. - Removed the deprecated `set_api_key` and `get_api_key` methods and replaced them with the `ElevenLabs` class instantiation. - Modified the `play_audio` function to handle the audio generator properly by collecting the audio data into a bytes-like object before writing it to a file and playing it. - Added detailed docstrings and comments for better understanding and maintenance of the code. - Ensured that the OpenAI client uses the correct API key and updated the image analysis to handle responses accurately. capture.py: - Ensured the frames folder is created if it doesn't exist. - Updated the webcam initialization check and added a wait time for the camera to adjust light levels. - Adjusted the image resizing logic to improve performance before saving the frame. - Added detailed print statements and comments for clarity and debugging purposes. These changes ensure compatibility with the latest ElevenLabs API and improve the overall robustness and readability of the code.
Author
|
@cbh123 this is the only working branch as of right now. |
|
@mgennings Confirmed this does work for me! Thank you for sharing this! Was using |
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.
Overview
This pull request updates the integration with the ElevenLabs API to reflect the latest changes and enhances the overall functionality of the Narrator project. Significant improvements have been made to both
narrator.pyandcapture.pyto ensure compatibility with the new API version and to optimize the performance and readability of the code. Additionally, this pull request introduces significant improvements to the way environment variables and API keys are handled in the Narrator project. By implementing a.envfile approach, we enhance the security and maintainability of the application.Changes Made
Updated ElevenLabs API Integration:
narrator.pyto use the new ElevenLabs client instantiation method.set_api_keyandget_api_keymethods with the newElevenLabsclass instantiation.play_audiofunction to handle the audio generator correctly, gathering audio data into a bytes-like object before writing it to a file and playing it.Enhanced
narrator.py:Optimized
capture.py:Enhanced Security:
narrator.pyto load API keys and other sensitive information from a.envfile using thepython-dotenvpackage.requirements.txtto include thepython-dotenvpackage..envfile for managing environment variables.Benefits
.envfile method prevents sensitive keys from being hard-coded into the script or inadvertently pushed to the repository.Additional Notes
.envfile is included in.gitignoreto ensure that personal API keys are kept private..envfile.Closing Previous Pull Request
The previous pull request titled "Enhance Security: Implement .env for API Keys #44" will be closed as the changes in this new pull request supersede the previous updates and provide a more comprehensive solution.
Looking forward to feedback and suggestions on these enhancements.