karimouda commited on
Commit
2f9d246
·
verified ·
1 Parent(s): f19c471

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -9
app.py CHANGED
@@ -5,16 +5,15 @@ import tempfile
5
  from importlib.resources import files
6
  from silma_tts.api import SilmaTTS
7
 
 
 
 
8
 
9
  @spaces.GPU(duration=120)
10
  def do_inference(ref_audio, ref_text, gen_text):
11
  if not ref_audio:
12
  return None
13
 
14
- print("Loading SILMA TTS model...", flush=True)
15
- silma_tts = SilmaTTS()
16
-
17
-
18
  _, output_wav_path = tempfile.mkstemp(suffix=".wav")
19
 
20
  wav, sr, _ = silma_tts.infer(
@@ -24,15 +23,24 @@ def do_inference(ref_audio, ref_text, gen_text):
24
  file_wave=output_wav_path,
25
  )
26
 
27
- print("Done")
28
- print(output_wav_path)
29
- print(wav)
30
 
31
- return wav
32
 
33
 
34
  with gr.Blocks() as demo:
35
- gr.Markdown("# SILMA TTS Demo")
 
 
 
 
 
 
 
 
 
 
 
 
36
  gr.Markdown("Add reference audio, reference text and generation text then click 'Generate Speech'")
37
 
38
  with gr.Row():
 
5
  from importlib.resources import files
6
  from silma_tts.api import SilmaTTS
7
 
8
+ print("Loading SILMA TTS model...", flush=True)
9
+ silma_tts = SilmaTTS()
10
+
11
 
12
  @spaces.GPU(duration=120)
13
  def do_inference(ref_audio, ref_text, gen_text):
14
  if not ref_audio:
15
  return None
16
 
 
 
 
 
17
  _, output_wav_path = tempfile.mkstemp(suffix=".wav")
18
 
19
  wav, sr, _ = silma_tts.infer(
 
23
  file_wave=output_wav_path,
24
  )
25
 
 
 
 
26
 
27
+ return output_wav_path
28
 
29
 
30
  with gr.Blocks() as demo:
31
+
32
+ gr.HTML(
33
+ f"""<h1><img src='/gradio_api/file={CURR_BASE_DIR}/images/silma-logo.png'/>SILMA TTS Demo</h1>
34
+ <br>
35
+ <p style="font-size:16px">
36
+ SILMA TTS v1 is a high-performance, 150M-parameter bilingual (Arabic/English) TTS model developed by <a href="https://silma.ai">SILMA.AI</a>. You can download the model or learn more via the links below:
37
+ - <a href="https://huggingface.co/silma-ai/silma-tts" target="_blank">https://huggingface.co/silma-ai/silma-tts</a>
38
+ - <a href="https://github.com/SILMA-AI/silma-tts" target="_blank">https://github.com/SILMA-AI/silma-tts</a>
39
+ </p>
40
+ """,
41
+ elem_id="tool-header"
42
+ )
43
+
44
  gr.Markdown("Add reference audio, reference text and generation text then click 'Generate Speech'")
45
 
46
  with gr.Row():