Quang Long commited on
Commit
52ff743
·
1 Parent(s): b8c51d6
Files changed (2) hide show
  1. app.py +2 -0
  2. app_tts.py +5 -1
app.py CHANGED
@@ -281,6 +281,8 @@ def sadtalker_demo():
281
  interactive=False,
282
  value="",
283
  visible=True,
 
 
284
  )
285
 
286
  def enable_generate(audio, text, image):
 
281
  interactive=False,
282
  value="",
283
  visible=True,
284
+ lines=3,
285
+ max_lines=4
286
  )
287
 
288
  def enable_generate(audio, text, image):
app_tts.py CHANGED
@@ -1,4 +1,5 @@
1
- import os
 
2
  import hashlib
3
  import soundfile as sf
4
  import gradio as gr
@@ -10,6 +11,7 @@ from datetime import datetime
10
  from huggingface_hub import login
11
  from cached_path import cached_path
12
 
 
13
  # Import hàm infer gốc của f5_tts
14
  from f5_tts.infer.utils_infer import (
15
  preprocess_ref_audio_text,
@@ -162,6 +164,7 @@ def infer_tts(
162
 
163
  cache_path = get_audio_cache_path(text_chunk, ref_audio_orig, model)
164
  if os.path.exists(cache_path):
 
165
  wave, sample_rate = sf.read(cache_path)
166
  else:
167
  clean_chunk = normalize_for_tts(text_chunk) # <- thêm dòng này
@@ -175,6 +178,7 @@ def infer_tts(
175
  speed=speed,
176
  nfe_step=16, # giảm tải
177
  )
 
178
  sf.write(cache_path, wave, sample_rate)
179
 
180
  final_audio_segments.append(wave)
 
1
+ import os, sys
2
+
3
  import hashlib
4
  import soundfile as sf
5
  import gradio as gr
 
11
  from huggingface_hub import login
12
  from cached_path import cached_path
13
 
14
+ sys.path.append(os.path.join(os.path.dirname(__file__), "src"))
15
  # Import hàm infer gốc của f5_tts
16
  from f5_tts.infer.utils_infer import (
17
  preprocess_ref_audio_text,
 
164
 
165
  cache_path = get_audio_cache_path(text_chunk, ref_audio_orig, model)
166
  if os.path.exists(cache_path):
167
+ print(f"Using cached audio: {cache_path}")
168
  wave, sample_rate = sf.read(cache_path)
169
  else:
170
  clean_chunk = normalize_for_tts(text_chunk) # <- thêm dòng này
 
178
  speed=speed,
179
  nfe_step=16, # giảm tải
180
  )
181
+ print(f"[CACHE] Saved new audio to: {cache_path}")
182
  sf.write(cache_path, wave, sample_rate)
183
 
184
  final_audio_segments.append(wave)