Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -511,16 +511,15 @@ def get_female_voices():
|
|
| 511 |
|
| 512 |
@app.route('/api/summary', methods=['GET'])
|
| 513 |
def get_summary():
|
| 514 |
-
"""Endpoint to get summary of languages and voices"""
|
| 515 |
languages = set()
|
| 516 |
total_voices = 0
|
| 517 |
male_voices = 0
|
| 518 |
female_voices = 0
|
| 519 |
|
| 520 |
for voice_name, voice_id in VOICES.items():
|
| 521 |
-
# Extract language code
|
| 522 |
-
|
| 523 |
-
lang_code = f"{parts[0]}-{parts[1]}" # Combine first two parts (e.g., 'en-US')
|
| 524 |
languages.add(lang_code)
|
| 525 |
|
| 526 |
# Count total voices
|
|
@@ -537,8 +536,7 @@ def get_summary():
|
|
| 537 |
"total_voices": total_voices,
|
| 538 |
"total_male_voices": male_voices,
|
| 539 |
"total_female_voices": female_voices,
|
| 540 |
-
"note": "Language counts are based on language
|
| 541 |
})
|
| 542 |
-
|
| 543 |
if __name__ == '__main__':
|
| 544 |
app.run(host="0.0.0.0", port=7860, threaded=True)
|
|
|
|
| 511 |
|
| 512 |
@app.route('/api/summary', methods=['GET'])
|
| 513 |
def get_summary():
|
| 514 |
+
"""Endpoint to get summary of languages and voices (ignoring regional variations)"""
|
| 515 |
languages = set()
|
| 516 |
total_voices = 0
|
| 517 |
male_voices = 0
|
| 518 |
female_voices = 0
|
| 519 |
|
| 520 |
for voice_name, voice_id in VOICES.items():
|
| 521 |
+
# Extract only the language code (e.g., 'en' from 'en-US-AndrewNeural')
|
| 522 |
+
lang_code = voice_id.split('-')[0] # Only take the first part
|
|
|
|
| 523 |
languages.add(lang_code)
|
| 524 |
|
| 525 |
# Count total voices
|
|
|
|
| 536 |
"total_voices": total_voices,
|
| 537 |
"total_male_voices": male_voices,
|
| 538 |
"total_female_voices": female_voices,
|
| 539 |
+
"note": "Language counts are based on language codes only (e.g., en-US and en-GB both count as 'en')"
|
| 540 |
})
|
|
|
|
| 541 |
if __name__ == '__main__':
|
| 542 |
app.run(host="0.0.0.0", port=7860, threaded=True)
|