def youtube_url_to_text(url, model_id, language_choice):
    """
    Main function that downloads and converts a video to MP3 format, performs speech-to-text conversion using
    a specified model, and returns the transcript along with the video path.

    Args:
        url (str): The URL of the video to download and convert.
        model_id (str): The ID of the speech-to-text model to use.
        language_choice (str): The language choice for the speech-to-text conversion.

    Returns:
        transcript (str): The transcript of the speech-to-text conversion.
    """
    audio_path = download_youtube_to_mp3(url, output_dir="downloads", filename="test")

    hqq_config = HqqConfig(
        nbits=4,
        group_size=64,
        quant_zero=False,
        quant_scale=False,
        axis=0,
        offload_meta=False,
    )  # axis=0 is used by default

    pipeline = SpeechToTextPipeline(
        model_id=model_id,
        quant_config=hqq_config,
        flash_attention_2=True,
    )

    transcript = pipeline(
        audio_path=audio_path,
        chunk_length_s=30,
        stride_length_s=5,
        max_new_tokens=128,
        batch_size=100,
        language=language_choice,
        return_timestamps=False,
    )
    return transcript

    Main function that downloads and converts a video to MP3 format, performs speech-to-text conversion using
    a specified model, and returns the transcript along with the video path.

    Args:
        url (str): The URL of the video to download and convert.
        model_id (str): The ID of the speech-to-text model to use.
        language_choice (str): The language choice for the speech-to-text conversion.

    Returns:
        transcript (str): The transcript of the speech-to-text conversion.
    
whisperplus/app.py