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

Move the normalizer to the ML API #77

Merged
merged 4 commits into from
Mar 19, 2024
Merged

Conversation

matthewkennedy5
Copy link
Contributor

@matthewkennedy5 matthewkennedy5 commented Mar 19, 2024

Description

  • Introduced a new /normalize endpoint to the ML router for text normalization, improving the text processing capabilities.
  • Created a shared TextInput BaseModel to standardize text input across different endpoints.
  • Refactored the text_to_speech endpoint to utilize the new TextInput model.
  • Implemented conditional logic to load the text normalizer only when not in development mode, controlled by the IS_DEV environment variable.
  • Removed redundant text normalization code from the voice router and added a new async function to call the ML service for normalization.
  • Updated environment variable handling in settings to simplify the development mode check.
  • Corrected the docker-compose configuration to start the ML service on the right port with the updated application path.

Changes walkthrough

Relevant files
Enhancement
ml.py
Add text normalization endpoint and refactor TTS endpoint           

openduck-py/openduck_py/routers/ml.py

  • Added a new endpoint /normalize to the ML router for text
    normalization.
  • Introduced TextInput BaseModel for text input to endpoints.
  • Refactored the text_to_speech endpoint to use the new TextInput model.
  • Implemented conditional loading of the text normalizer based on the
    IS_DEV environment variable.
  • +21/-8   
    voice.py
    Integrate new normalization endpoint in voice router                     

    openduck-py/openduck_py/routers/voice.py

  • Removed local text normalization logic.
  • Added _normalize_text async function to call the new ML service
    normalization endpoint.
  • Updated speak_response to use the new _normalize_text function.
  • +13/-14 
    Configuration changes
    __init__.py
    Update environment variable handling for development mode           

    openduck-py/openduck_py/settings/init.py

  • Removed DEPLOY_ENV variable.
  • Changed IS_DEV to be a boolean directly read from the environment
    variable.
  • +1/-2     
    docker-compose.yml
    Fix docker-compose command for ML service startup                           

    docker-compose.yml

  • Updated the command to start the ML service with the correct
    application path and port.
  • +2/-2     
    💡 Usage Guide

    Checking Your Pull Request

    Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

    Talking to CodeAnt AI

    Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

    @codeant-ai ask: Your question here
    

    This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

    Check Your Repository Health

    To analyze the health of your code repository, visit our dashboard at app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

    Copy link

    vercel bot commented Mar 19, 2024

    The latest updates on your projects. Learn more about Vercel for Git ↗︎

    Name Status Preview Updated (UTC)
    openduck ✅ Ready (Inspect) Visit Preview Mar 19, 2024 7:05pm

    Copy link

    netlify bot commented Mar 19, 2024

    Deploy Preview for openduck canceled.

    Name Link
    🔨 Latest commit ef76ed5
    🔍 Latest deploy log https://app.netlify.com/sites/openduck/deploys/65f9e211c9618500085dcd1a

    @codeant-ai codeant-ai bot added enhancement New feature or request bug_fix labels Mar 19, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    bug_fix enhancement New feature or request
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants