Spaces:
Running
on
Zero
Running
on
Zero
add logg
Browse files
app.py
CHANGED
|
@@ -5,6 +5,10 @@ from huggingface_hub import hf_hub_download
|
|
| 5 |
import sys
|
| 6 |
import soundfile as sf
|
| 7 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
#Chemin local de téléchargement des fichiers (il faut s'assurer que le dossier existe)
|
| 10 |
LOCAL_DOWNLOAD_PATH = "./local_model"
|
|
@@ -20,13 +24,17 @@ sys.path.insert(0, LOCAL_DOWNLOAD_PATH)
|
|
| 20 |
from inference import generate_audio
|
| 21 |
|
| 22 |
def tts(text, audio_reference):
|
|
|
|
| 23 |
if text and audio_reference is not None:
|
| 24 |
#Sauvegarde temporaire de l'audio reference
|
| 25 |
temp_audio_path = "temp_audio_ref.wav"
|
| 26 |
sf.write(temp_audio_path, audio_reference, 44100)
|
|
|
|
| 27 |
audio_output, sample_rate = generate_audio(text, temp_audio_path, LOCAL_DOWNLOAD_PATH)
|
|
|
|
| 28 |
return (sample_rate, audio_output)
|
| 29 |
else:
|
|
|
|
| 30 |
return "Veuillez entrer un texte et fournir un audio de référence."
|
| 31 |
|
| 32 |
demo = gr.Interface(
|
|
|
|
| 5 |
import sys
|
| 6 |
import soundfile as sf
|
| 7 |
import numpy as np
|
| 8 |
+
import logging
|
| 9 |
+
|
| 10 |
+
# Configuration du logger
|
| 11 |
+
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
|
| 12 |
|
| 13 |
#Chemin local de téléchargement des fichiers (il faut s'assurer que le dossier existe)
|
| 14 |
LOCAL_DOWNLOAD_PATH = "./local_model"
|
|
|
|
| 24 |
from inference import generate_audio
|
| 25 |
|
| 26 |
def tts(text, audio_reference):
|
| 27 |
+
logging.debug(f"tts function called with text: {text} and audio_reference: {audio_reference}")
|
| 28 |
if text and audio_reference is not None:
|
| 29 |
#Sauvegarde temporaire de l'audio reference
|
| 30 |
temp_audio_path = "temp_audio_ref.wav"
|
| 31 |
sf.write(temp_audio_path, audio_reference, 44100)
|
| 32 |
+
logging.debug(f"Audio reference saved to {temp_audio_path}")
|
| 33 |
audio_output, sample_rate = generate_audio(text, temp_audio_path, LOCAL_DOWNLOAD_PATH)
|
| 34 |
+
logging.debug(f"Audio generated with sample rate: {sample_rate}")
|
| 35 |
return (sample_rate, audio_output)
|
| 36 |
else:
|
| 37 |
+
logging.debug("Text or audio reference is missing")
|
| 38 |
return "Veuillez entrer un texte et fournir un audio de référence."
|
| 39 |
|
| 40 |
demo = gr.Interface(
|