TGPro1 commited on
Commit
ae76cda
·
verified ·
1 Parent(s): b4f1d87

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -59,7 +59,7 @@ if not hasattr(torchaudio, "info"):
59
 
60
  from df.enhance import enhance, init_df, load_audio, save_audio
61
 
62
- # FORCE BUILD TRIGGER: 15:45:00 Jan 20 2026
63
 
64
  # 🛠️ Monkeypatch torchaudio.load
65
  try:
@@ -150,6 +150,15 @@ def core_process(request_dict):
150
  elif action == "tts":
151
  text = request_dict.get("text")
152
  lang = request_dict.get("lang")
 
 
 
 
 
 
 
 
 
153
  speaker_wav_b64 = request_dict.get("speaker_wav")
154
  speaker_wav_path = None
155
  if speaker_wav_b64:
 
59
 
60
  from df.enhance import enhance, init_df, load_audio, save_audio
61
 
62
+ # FORCE BUILD TRIGGER: 15:58:00 Jan 20 2026
63
 
64
  # 🛠️ Monkeypatch torchaudio.load
65
  try:
 
150
  elif action == "tts":
151
  text = request_dict.get("text")
152
  lang = request_dict.get("lang")
153
+
154
+ if not text or not text.strip():
155
+ return {"error": "TTS Error: Input text is empty"}
156
+
157
+ # 🧹 Normalize language code
158
+ if lang:
159
+ lang = lang.strip().lower()
160
+ # Map complex codes to 2-letter codes if needed, e.g., 'fr-fr' -> 'fr'
161
+ if '-' in lang: lang = lang.split('-')[0]
162
  speaker_wav_b64 = request_dict.get("speaker_wav")
163
  speaker_wav_path = None
164
  if speaker_wav_b64: