Spaces:
Sleeping
Sleeping
File size: 6,540 Bytes
3e08670 | 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | """
📊 Résumé complet du projet MMS ASR/TTS API
Ce projet fournit une API Flask pour:
- ASR (Automatic Speech Recognition): Audio → Texte avec support 100+ langues
- TTS (Text-to-Speech): Texte → Audio pour 8 langues
Utilise les modèles Meta MMS:
- facebook/mms-1b-all (ASR, 964M params)
- facebook/mms-tts-{lang} (TTS, 8 langues)
"""
import json
PROJECT_STRUCTURE = {
"docs": {
"README.md": "Documentation générale du projet",
"ARCHITECTURE.md": "Architecture technique détaillée",
"DEPLOYMENT.md": "Guide de déploiement sur Hugging Face Spaces",
},
"source_code": {
"app.py": "API Flask v1 - Version stable",
"app_v2.py": "API Flask v2 - Version optimisée (RECOMMANDÉE) ⭐",
"client.py": "Client Python pour tester l'API",
"examples.py": "Exemples d'utilisation des endpoints",
},
"testing": {
"test_api.py": "Tests unitaires avec pytest",
"setup_project.py": "Script de vérification et setup du projet",
},
"deployment": {
"requirements.txt": "Dépendances production",
"requirements-dev.txt": "Dépendances développement (tests, linting)",
"Dockerfile": "Conteneur Docker pour déploiement",
"docker-compose.yml": "Orchestration Docker (GPU support)",
".gitignore": "Fichiers à ignorer par Git",
},
}
QUICK_START = """
🚀 DÉMARRAGE RAPIDE
═══════════════════════════════════════════════════════════════
1️⃣ Installation:
cd /home/ronaldo/Bureau/test
pip install -r requirements.txt
2️⃣ Lancer l'API:
python app_v2.py
# API disponible sur http://localhost:7860
3️⃣ Tester dans un autre terminal:
python examples.py
4️⃣ Tester avec curl:
# ASR - Convertir audio en texte
curl -X POST -F "audio=@audio.wav" \\
http://localhost:7860/asr
# TTS - Convertir texte en audio
curl -X POST -H "Content-Type: application/json" \\
-d '{"text":"Hello","language":"eng"}' \\
http://localhost:7860/tts --output hello.wav
5️⃣ Déployer sur Hugging Face:
Voir DEPLOYMENT.md pour les instructions
"""
FEATURES = {
"ASR": {
"model": "facebook/mms-1b-all",
"languages": "100+ langues (ISO 639-3)",
"input": "Audio (WAV, MP3, etc.)",
"output": "Texte transcrit",
"endpoint": "POST /asr",
},
"TTS": {
"model": "facebook/mms-tts-* (VITS)",
"languages": 8,
"supported": ["beh", "bba", "ddn", "ewe", "gej", "tbz", "yor", "eng"],
"input": "Texte (max 1000 chars)",
"output": "Audio WAV (22050 Hz)",
"endpoint": "POST /tts",
},
"General": {
"framework": "Flask",
"gpu_support": "CUDA auto-detect",
"cache": "In-memory model cache (thread-safe)",
"cors": "Enabled",
"max_audio": "30 secondes",
"max_text": "1000 caractères",
},
}
ENDPOINTS = {
"GET /": "Documentation de l'API",
"GET /health": "État du service + device info",
"GET /supported-languages": "Langues supportées",
"GET /models-info": "Informations détaillées sur les modèles",
"POST /asr": "Audio → Texte (ASR)",
"POST /tts": "Texte → Audio (TTS)",
}
def print_section(title, content=None):
"""Affiche une section formatée"""
print(f"\n{'═' * 70}")
print(f" {title}")
print(f"{'═' * 70}")
if content:
print(content)
def print_project_structure():
"""Affiche la structure du projet"""
for category, files in PROJECT_STRUCTURE.items():
print(f"\n📂 {category.upper()}:")
for filename, description in files.items():
print(f" 📄 {filename:25} → {description}")
def print_features():
"""Affiche les features"""
print(f"\n🎯 FEATURES:")
for feature, details in FEATURES.items():
print(f"\n {feature}:")
for key, value in details.items():
if isinstance(value, list):
value = ", ".join(value)
print(f" • {key}: {value}")
def print_endpoints():
"""Affiche les endpoints"""
print(f"\n📡 API ENDPOINTS:")
for endpoint, description in ENDPOINTS.items():
print(f" {endpoint:25} → {description}")
def main():
"""Fonction principale"""
print("""
╔════════════════════════════════════════════════════════════════╗
║ 🎙️ Meta MMS ASR/TTS API 🔊 ║
║ Reconnaissance vocale + Synthèse vocale ║
║ Multilingue & GPU-ready ║
╚════════════════════════════════════════════════════════════════╝
""")
print_section("📋 STRUCTURE DU PROJET")
print_project_structure()
print_section("🎯 FEATURES")
print_features()
print_section("📡 API ENDPOINTS")
print_endpoints()
print_section("🚀 DÉMARRAGE RAPIDE")
print(QUICK_START)
print_section("💡 INFORMATIONS SUPPLÉMENTAIRES")
print("""
✅ Recommandations:
• Utiliser app_v2.py (v1 is deprecated)
• Installer requirements.txt pour prod
• Voir examples.py pour voir comment utiliser l'API
• Pour dev: pip install -r requirements-dev.txt
📚 Documentation complète:
• README.md - Documentation générale
• ARCHITECTURE.md - Architecture technique
• DEPLOYMENT.md - Déploiement sur HF Spaces
🧪 Tests:
• pytest test_api.py -v
📊 Déploiement:
• Local: python app_v2.py
• Docker: docker build -t mms . && docker run -p 7860:7860 mms
• HF Spaces: Voir DEPLOYMENT.md
🌐 URLs importantes:
• facebook/mms-1b-all: https://huggingface.co/facebook/mms-1b-all
• facebook/mms-tts: https://huggingface.co/facebook/mms-tts
• Meta MMS Paper: https://arxiv.org/abs/2305.13516
""")
print_section("🎓 PROCHAINES ÉTAPES")
print("""
1. ✅ Installer les dépendances
2. ✅ Lancer l'API localement
3. ✅ Tester les endpoints
4. ✅ Déployer sur Hugging Face Spaces
5. ✅ Ajouter des features (streaming, batch, etc.)
Bon codage! 🚀
""")
if __name__ == "__main__":
main()
|