playmak3r commited on
Commit
743b8f5
·
1 Parent(s): a8f789a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -1,21 +1,27 @@
1
  import spaces
2
- import os
3
- import sys
4
  sys.path.append("neutts-air")
5
  from neuttsair.neutts import NeuTTSAir
6
  import numpy as np
7
  import gradio as gr
8
 
 
9
  SAMPLES_PATH = os.path.join(os.getcwd(), "neutts-air", "samples")
10
  DEFAULT_REF_TEXT = "So I'm live on radio. And I say, well, my dear friend James here clearly, and the whole room just froze. Turns out I'd completely misspoken and mentioned our other friend."
11
  DEFAULT_REF_PATH = os.path.join(SAMPLES_PATH, "dave.wav")
12
  DEFAULT_GEN_TEXT = "My name is Dave, and um, I'm from London."
13
 
 
 
 
 
 
 
14
  tts = NeuTTSAir(
15
  backbone_repo="neuphonic/neutts-air",
16
- backbone_device="cuda",
17
  codec_repo="neuphonic/neucodec",
18
- codec_device="cuda"
19
  )
20
 
21
  @spaces.GPU()
@@ -35,6 +41,7 @@ def infer(
35
  tuple [int, np.ndarray]: A tuple containing the sample rate (24000) and the generated audio waveform as a numpy array.
36
  """
37
 
 
38
  gr.Info("Starting inference request!")
39
  gr.Info("Encoding reference...")
40
  ref_codes = tts.encode_reference(ref_audio_path)
 
1
  import spaces
2
+ import os, sys, logging
 
3
  sys.path.append("neutts-air")
4
  from neuttsair.neutts import NeuTTSAir
5
  import numpy as np
6
  import gradio as gr
7
 
8
+
9
  SAMPLES_PATH = os.path.join(os.getcwd(), "neutts-air", "samples")
10
  DEFAULT_REF_TEXT = "So I'm live on radio. And I say, well, my dear friend James here clearly, and the whole room just froze. Turns out I'd completely misspoken and mentioned our other friend."
11
  DEFAULT_REF_PATH = os.path.join(SAMPLES_PATH, "dave.wav")
12
  DEFAULT_GEN_TEXT = "My name is Dave, and um, I'm from London."
13
 
14
+ logging.basicConfig(
15
+ level=logging.INFO,
16
+ format="%(asctime)s [%(levelname)s] %(message)s",
17
+ stream=sys.stdout
18
+ )
19
+
20
  tts = NeuTTSAir(
21
  backbone_repo="neuphonic/neutts-air",
22
+ backbone_device="cpu",
23
  codec_repo="neuphonic/neucodec",
24
+ codec_device="cpu"
25
  )
26
 
27
  @spaces.GPU()
 
41
  tuple [int, np.ndarray]: A tuple containing the sample rate (24000) and the generated audio waveform as a numpy array.
42
  """
43
 
44
+ logging.info(f"Using reference: {ref_audio_path}")
45
  gr.Info("Starting inference request!")
46
  gr.Info("Encoding reference...")
47
  ref_codes = tts.encode_reference(ref_audio_path)