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

Check all whisper response["segments"] for no_speech_prob < 0.5 #121

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

matthewkennedy5
Copy link
Contributor

@matthewkennedy5 matthewkennedy5 commented Apr 2, 2024

User description

Previously I was only looking at the first transcribed segment, response["segments"][0]. That caused a problem when there were multiple detected segments and the first segment had no_speech_prob > 0.5, but later segments contained actual speech. Now it looks at all segments, filtering out the segments with no_speech_prob > 0.5.


Description

  • Improved the transcription logic in the transcribe_audio function to iterate over all audio segments, filtering out those with a no_speech_prob higher than the defined threshold.
  • This change ensures that all segments with actual speech are considered, which fixes the issue where only the first segment was checked, potentially ignoring valid speech in subsequent segments.
  • Debugging assistance added with the pprint function to print the response for development purposes.

Changes walkthrough

Relevant files
Enhancement
ml.py
Enhance transcription logic to handle multiple audio segments   

openduck-py/openduck_py/routers/ml.py

  • Added pprint import for debugging purposes.
  • Removed unnecessary imports and reorganized them.
  • Enhanced the transcription logic to consider all audio segments
    instead of just the first one.
  • Filtered out segments with a no_speech_prob higher than the threshold.

  • +13/-8   
    💡 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 Apr 2, 2024

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

    Name Status Preview Updated (UTC)
    openduck ✅ Ready (Inspect) Visit Preview Apr 2, 2024 7:47pm

    @codeant-ai codeant-ai bot added enhancement New feature or request bug_fix labels Apr 2, 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.

    None yet

    2 participants