jhj0517 commited on
Commit
6065501
·
1 Parent(s): f403068

fix spaces bug

Browse files
Files changed (2) hide show
  1. app.py +5 -1
  2. modules/whisper/whisper_base.py +3 -0
app.py CHANGED
@@ -15,7 +15,11 @@ class App:
15
  def __init__(self, args):
16
  self.args = args
17
  self.app = gr.Blocks(css=CSS, theme=self.args.theme)
18
- self.whisper_inf = self.init_whisper()
 
 
 
 
19
  print(f"Use \"{self.args.whisper_type}\" implementation")
20
  print(f"Device \"{self.whisper_inf.device}\" is detected")
21
  self.nllb_inf = NLLBInference(
 
15
  def __init__(self, args):
16
  self.args = args
17
  self.app = gr.Blocks(css=CSS, theme=self.args.theme)
18
+ self.whisper_inf = FasterWhisperInference(
19
+ model_dir=self.args.faster_whisper_model_dir,
20
+ output_dir=self.args.output_dir,
21
+ args=self.args
22
+ )
23
  print(f"Use \"{self.args.whisper_type}\" implementation")
24
  print(f"Device \"{self.whisper_inf.device}\" is detected")
25
  self.nllb_inf = NLLBInference(
modules/whisper/whisper_base.py CHANGED
@@ -42,6 +42,7 @@ class WhisperBase(ABC):
42
  self.vad = SileroVAD()
43
 
44
  @abstractmethod
 
45
  def transcribe(self,
46
  audio: Union[str, BinaryIO, np.ndarray],
47
  progress: gr.Progress,
@@ -50,6 +51,7 @@ class WhisperBase(ABC):
50
  pass
51
 
52
  @abstractmethod
 
53
  def update_model(self,
54
  model_size: str,
55
  compute_type: str,
@@ -57,6 +59,7 @@ class WhisperBase(ABC):
57
  ):
58
  pass
59
 
 
60
  def run(self,
61
  audio: Union[str, BinaryIO, np.ndarray],
62
  progress: gr.Progress,
 
42
  self.vad = SileroVAD()
43
 
44
  @abstractmethod
45
+ @spaces.GPU(duration=120)
46
  def transcribe(self,
47
  audio: Union[str, BinaryIO, np.ndarray],
48
  progress: gr.Progress,
 
51
  pass
52
 
53
  @abstractmethod
54
+ @spaces.GPU(duration=120)
55
  def update_model(self,
56
  model_size: str,
57
  compute_type: str,
 
59
  ):
60
  pass
61
 
62
+ @spaces.GPU(duration=120)
63
  def run(self,
64
  audio: Union[str, BinaryIO, np.ndarray],
65
  progress: gr.Progress,