slevin48 / ami

Artificial Market Intelligence App 🤖
https://conseil-dami.streamlit.app/
MIT License
0 stars 0 forks source link

Enable TTS on full article #4

Open slevin48 opened 9 months ago

slevin48 commented 9 months ago

Something like this:

# Audio
with st.sidebar.expander("Text to Speech"):
    voice = st.radio("Select Voice", voices)
    tts_input = st.toggle("Full text/Summary", 
                          disabled = summary_path not in summaries,
                          value = summary_path in summaries)
    # st.write(tts_input)
    tts_choice = {0: text, 1: summary}
    if st.button("TTS"):
        tts_s3(tts_choice[tts_input], article, episode, voice, BUCKET_NAME)
        st.write("Audio generated.")

Looks like this:

image

Only problem is the text length (max 4096 characters): BadRequestError: Error code: 400 - {'error': {'message': '1 validation error for Request\nbody -> input\n ensure this value has at most 4096 characters (type=value_error.any_str.max_length; limit_value=4096)', 'type': 'invalid_request_error', 'param': None, 'code': None}}

slevin48 commented 4 months ago

5000 characters limit with Elevenlabs elevenlabs.core.api_error.ApiError: status_code: 400, body: {'detail': {'status': 'max_character_limit_exceeded', 'message': "This request's text has 8290.0 characters and exceeds the character limit of 5000 characters for paying users. Please user Projects for long form TTS."}}