Spaces:
Running
Running
Update speech_api.py
Browse files- speech_api.py +2 -2
speech_api.py
CHANGED
@@ -16,7 +16,7 @@ client = BhashiniClient(user_id=ULCA_USER_ID, api_key=ULCA_API_KEY)
|
|
16 |
|
17 |
class TTSRequest(BaseModel):
|
18 |
text: str
|
19 |
-
|
20 |
|
21 |
SUPPORTED_LANGUAGES = {'pa', 'mr', 'bn', 'en', 'as', 'or', 'ta', 'te', 'kn', 'gu', 'hi', 'ml'}
|
22 |
|
@@ -45,7 +45,7 @@ async def text_to_speech(request: TTSRequest):
|
|
45 |
tts_result = client.tts(
|
46 |
request.text,
|
47 |
source_language=detected_language,
|
48 |
-
gender=request.
|
49 |
)
|
50 |
|
51 |
audio_base64 = tts_result['pipelineResponse'][0]['audio'][0]['audioContent']
|
|
|
16 |
|
17 |
class TTSRequest(BaseModel):
|
18 |
text: str
|
19 |
+
voice: str = "female"
|
20 |
|
21 |
SUPPORTED_LANGUAGES = {'pa', 'mr', 'bn', 'en', 'as', 'or', 'ta', 'te', 'kn', 'gu', 'hi', 'ml'}
|
22 |
|
|
|
45 |
tts_result = client.tts(
|
46 |
request.text,
|
47 |
source_language=detected_language,
|
48 |
+
gender=request.voice
|
49 |
)
|
50 |
|
51 |
audio_base64 = tts_result['pipelineResponse'][0]['audio'][0]['audioContent']
|