Spaces:
Sleeping
Sleeping
Commit ·
3293398
1
Parent(s): 5ba53f6
fix
Browse files
app.py
CHANGED
|
@@ -19,7 +19,8 @@ app = FastAPI()
|
|
| 19 |
|
| 20 |
print("Test du modèle TTS...")
|
| 21 |
try:
|
| 22 |
-
tts.tts_to_file(text="Test audio",
|
|
|
|
| 23 |
print("Le modèle fonctionne correctement.")
|
| 24 |
except Exception as e:
|
| 25 |
print("Erreur lors du test du modèle :", e)
|
|
@@ -43,7 +44,7 @@ def generate_tts(input: TextInput):
|
|
| 43 |
|
| 44 |
|
| 45 |
# Générer l'audio
|
| 46 |
-
tts.tts_to_file(text=input.text, file_path=output_path)
|
| 47 |
|
| 48 |
print("tmp file generated")
|
| 49 |
|
|
@@ -53,3 +54,15 @@ def generate_tts(input: TextInput):
|
|
| 53 |
|
| 54 |
if __name__ == "__main__":
|
| 55 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
print("Test du modèle TTS...")
|
| 21 |
try:
|
| 22 |
+
tts.tts_to_file(text="Test audio", speaker="p339", speaker_wav=None,
|
| 23 |
+
age=22, gender="F", emotion="neutral", file_path="test.wav")
|
| 24 |
print("Le modèle fonctionne correctement.")
|
| 25 |
except Exception as e:
|
| 26 |
print("Erreur lors du test du modèle :", e)
|
|
|
|
| 44 |
|
| 45 |
|
| 46 |
# Générer l'audio
|
| 47 |
+
tts.tts_to_file(text=input.text, speaker="p339", speaker_wav=None, age=22, gender="F", emotion="neutral", file_path=output_path)
|
| 48 |
|
| 49 |
print("tmp file generated")
|
| 50 |
|
|
|
|
| 54 |
|
| 55 |
if __name__ == "__main__":
|
| 56 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
tts.tts_to_file(
|
| 61 |
+
speaker="p339",
|
| 62 |
+
age=22,
|
| 63 |
+
gender="F",
|
| 64 |
+
text=text,
|
| 65 |
+
speaker_wav=None, # Optional: Use custom speaker embeddings
|
| 66 |
+
emotion=emotion, # Control the emotion (if supported by the model)
|
| 67 |
+
file_path=output_file
|
| 68 |
+
)
|