Hưng commited on
Commit
8086b99
·
1 Parent(s): 6557227

add reference text

Browse files
Files changed (3) hide show
  1. app.py +8 -2
  2. examples/pc-01.wav +2 -2
  3. examples/pc-02.wav +2 -2
app.py CHANGED
@@ -25,15 +25,18 @@ model = load_model(
25
 
26
 
27
  @spaces.GPU
28
- def infer(ref_audio_orig: str, gen_text: str, speed: float = 1.0):
29
  if ref_audio_orig is None:
30
  raise gr.Error("Reference audio is required.")
31
 
32
  if gen_text is None or gen_text.strip() == "":
33
  raise gr.Error("Text to generate is required.")
 
 
 
34
 
35
  try:
36
- ref_audio, ref_text = preprocess_ref_audio_text(ref_audio_orig, "")
37
  final_wave, final_sample_rate, combined_spectrogram = infer_process(
38
  ref_audio,
39
  ref_text,
@@ -62,6 +65,7 @@ iface = gr.Interface(
62
  fn=infer,
63
  inputs=[
64
  gr.components.Audio(type="filepath", label="Reference Audio"),
 
65
  gr.components.Textbox(label="Text to Generate", lines=3),
66
  gr.components.Slider(
67
  label="Speed",
@@ -83,11 +87,13 @@ iface = gr.Interface(
83
  [
84
  "examples/pc-01.wav",
85
  "để hiểu sâu sắc một sự việc, một vấn đề, từ đó khai thác được tốt hơn quá trình hình thành nên vấn đề",
 
86
  0.8,
87
  ],
88
  [
89
  "examples/pc-02.wav",
90
  "có nghĩa là cảm xúc là vốn có, là tức thời, là bản năng, đối với một sự việc con người có những phản ứng hay cảm xúc khác nhau",
 
91
  1.0,
92
  ],
93
  ],
 
25
 
26
 
27
  @spaces.GPU
28
+ def infer(ref_audio_orig: str, ref_text: str, gen_text: str, speed: float = 1.0):
29
  if ref_audio_orig is None:
30
  raise gr.Error("Reference audio is required.")
31
 
32
  if gen_text is None or gen_text.strip() == "":
33
  raise gr.Error("Text to generate is required.")
34
+
35
+ if ref_text is None or ref_text.strip() == "":
36
+ raise gr.Error("Ref Text is required.")
37
 
38
  try:
39
+ ref_audio, ref_text = preprocess_ref_audio_text(ref_audio_orig, ref_text)
40
  final_wave, final_sample_rate, combined_spectrogram = infer_process(
41
  ref_audio,
42
  ref_text,
 
65
  fn=infer,
66
  inputs=[
67
  gr.components.Audio(type="filepath", label="Reference Audio"),
68
+ gr.components.Textbox(label="Reference audio text", lines=3),
69
  gr.components.Textbox(label="Text to Generate", lines=3),
70
  gr.components.Slider(
71
  label="Speed",
 
87
  [
88
  "examples/pc-01.wav",
89
  "để hiểu sâu sắc một sự việc, một vấn đề, từ đó khai thác được tốt hơn quá trình hình thành nên vấn đề",
90
+ "Bà Lê Lan Chi, Tổng giám đốc Zalopay cho biết ứng dụng đã có một năm nhiều dấu ấn khi đồng hành với hàng triệu người dùng",
91
  0.8,
92
  ],
93
  [
94
  "examples/pc-02.wav",
95
  "có nghĩa là cảm xúc là vốn có, là tức thời, là bản năng, đối với một sự việc con người có những phản ứng hay cảm xúc khác nhau",
96
+ "Bạn đã nhận được thanh toán thành công số tiền ba mươi ngàn đồng",
97
  1.0,
98
  ],
99
  ],
examples/pc-01.wav CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5e27481cae3accd432adda8cf9a34ef553970c882e5adc8ff2b1169deb7af445
3
- size 609910
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56d9c08fb1fe301d792ea5c9b2d444bfccfd9d44e182917e4a1f9262d1312d2d
3
+ size 389198
examples/pc-02.wav CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b1f6590113afa83c71fc5be66d941e671da0d73d024eabdd114c93b466a372ea
3
- size 823434
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7cbb7046a690f83df184f0659d544dd5d879c7631ab12da7c05aa204b7b1741
3
+ size 336974