jhj0517 commited on
Commit
f33fd62
·
1 Parent(s): 81cd5f6

add debugging function to faster-whisper inference

Browse files
modules/whisper/faster_whisper_inference.py CHANGED
@@ -124,6 +124,40 @@ class FasterWhisperInference(WhisperBase):
124
  )
125
  print("update_model: finished")
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  def get_model_paths(self):
128
  """
129
  Get available models from models path including fine-tuned model.
 
124
  )
125
  print("update_model: finished")
126
 
127
+ # debug
128
+ @spaces.GPU(duration=120)
129
+ def transcribe_file(self,
130
+ files: list,
131
+ file_format: str,
132
+ add_timestamp: bool,
133
+ progress=gr.Progress(),
134
+ # *whisper_params,
135
+ ) -> list:
136
+ """
137
+ Write subtitle file from Files
138
+
139
+ Parameters
140
+ ----------
141
+ files: list
142
+ List of files to transcribe from gr.Files()
143
+ file_format: str
144
+ Subtitle File format to write from gr.Dropdown(). Supported format: [SRT, WebVTT, txt]
145
+ add_timestamp: bool
146
+ Boolean value from gr.Checkbox() that determines whether to add a timestamp at the end of the subtitle filename.
147
+ progress: gr.Progress
148
+ Indicator to show progress directly in gradio.
149
+ *whisper_params: tuple
150
+ Parameters related with whisper. This will be dealt with "WhisperParameters" data class
151
+
152
+ Returns
153
+ ----------
154
+ result_str:
155
+ Result of transcription to return to gr.Textbox()
156
+ result_file_path:
157
+ Output file path to return to gr.Files()
158
+ """
159
+ print('Transcription START')
160
+
161
  def get_model_paths(self):
162
  """
163
  Get available models from models path including fine-tuned model.