Spaces:
Sleeping
Sleeping
File size: 1,338 Bytes
5dec512 f655f69 5dec512 c2fa877 d984557 655c692 c2fa877 f655f69 95849c2 9281119 f655f69 9281119 f655f69 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import logging
import os
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s (%(filename)s): %(message)s",
)
logger = logging.getLogger("audio-books")
OPENAI_API_KEY = os.environ["OPENAI_API_KEY"]
ELEVENLABS_API_KEY = os.environ["ELEVEN_LABS_API_KEY"]
FILE_SIZE_MAX = 0.5 # in mb
OPENAI_MAX_PARALLEL = 10 # empirically set
# current limitation of available subscription.
# see: https://elevenlabs.io/docs/api-reference/text-to-speech#generation-and-concurrency-limits
ELEVENLABS_MAX_PARALLEL = 15
# VOICES_CSV_FP = "data/11labs_available_tts_voices.csv"
VOICES_CSV_FP = "data/11labs_available_tts_voices.reviewed.csv"
MAX_TEXT_LEN = 5000
DESCRIPTION = """\
# AI Audiobooks Generator
Create an audiobook from the input text automatically, using Gen-AI!
All you need to do - is to input the book text or select it from the provided Sample Inputs.
AI will do the rest:
- split text into characters
- select voice for each character
- preprocess text to better convey emotions during Text-to-Speech
- (optionally) add sound effects to create immersive atmosphere
- generate audiobook using Text-to-Speech model
"""
DEFAULT_TTS_STABILITY = 0.5
DEFAULT_TTS_STABILITY_ACCEPTABLE_RANGE = (0.3, 0.8)
DEFAULT_TTS_SIMILARITY_BOOST = 0.5
DEFAULT_TTS_STYLE = 0.0
CONTEXT_CHAR_LEN_FOR_TTS = 500
|