Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language Leap Package uplift #22

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

santosderek
Copy link

@santosderek santosderek commented Mar 11, 2023

A general uplift of the language leap package.

I would highly recommend pulling this branch down and testing locally; and/or if not comfortable merging, I think it would be a good reference to uplifting some areas of the code. I didn't see an area for unit tests but please correct me if I'm wrong 👍

If so, feel free to close the PR as desired, just thought it may help.

Changes include:

  • Moved modules into a more "package-like" structure. (I would recommend updating your Jupiter notebooks if needed).
  • Created a logger config and added respective loggers to modules within the package.
    • Logger can be switched to debug mode by using LOGGING env.
  • Created a central environment.py file for common ENVs and imports.
  • Merged common code found within the asr.py module into a helper function. (Both 'transcribe' and 'translate' functions could be replaced with the helper function if desired).
  • Files have been linted with Flake8 to match the pep8 standard.
  • Added Docstrings to areas of code where I've touched significantly.
  • Changed some code logic to use Guard Clauses.

As mentioned above, the directory structure for src/ now looks like:

$ tree
.
└── src
    ├── language_leap
    │   ├── asr.py
    │   ├── audio
    │   │   └── samples
    │   │       ├── english_speech_sample.wav
    │   │       └── japanese_speech_sample.wav
    │   ├── audio_translate.py
    │   ├── environment.py
    │   ├── get_audio_device_ids.py
    │   ├── __init__.py
    │   ├── subtitler.py
    │   ├── tts.py
    │   ├── voice_translator.py
    │   └── voicevox.py
    ├── run_voicevox_colab.ipynb
    └── run_whisper_colab.ipynb

If at any point in the future you wanted to make this a python package, or cythonize it, you could use this directory structure to manage package imports and/or easily place the package into a docker container during a build process.

@SociallyIneptWeeb
Copy link
Owner

Thanks a lot! I'll look into it when I have the time 👍

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.

2 participants