Spaces:
Running
Running
jhj0517
commited on
Commit
·
7cc2d4f
1
Parent(s):
2514ff4
add debug function
Browse files- app.py +1 -4
- modules/whisper/faster_whisper_inference.py +7 -1
app.py
CHANGED
@@ -78,9 +78,6 @@ class App:
|
|
78 |
else:
|
79 |
return gr.Checkbox(visible=True, value=False, label="Translate to English?", interactive=True)
|
80 |
|
81 |
-
def test(self):
|
82 |
-
print("\nWHAT HAPPEND?\n")
|
83 |
-
|
84 |
def launch(self):
|
85 |
with self.app:
|
86 |
with gr.Row():
|
@@ -164,7 +161,7 @@ class App:
|
|
164 |
# btn_run.click(fn=self.whisper_inf.transcribe_file,
|
165 |
# inputs=params + whisper_params.as_list(),
|
166 |
# outputs=[tb_indicator, files_subtitles])
|
167 |
-
btn_run.click(fn=self.test, inputs=None, outputs=None)
|
168 |
dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|
169 |
|
170 |
with gr.TabItem("Youtube"): # tab2
|
|
|
78 |
else:
|
79 |
return gr.Checkbox(visible=True, value=False, label="Translate to English?", interactive=True)
|
80 |
|
|
|
|
|
|
|
81 |
def launch(self):
|
82 |
with self.app:
|
83 |
with gr.Row():
|
|
|
161 |
# btn_run.click(fn=self.whisper_inf.transcribe_file,
|
162 |
# inputs=params + whisper_params.as_list(),
|
163 |
# outputs=[tb_indicator, files_subtitles])
|
164 |
+
btn_run.click(fn=self.whisper_inf.test, inputs=None, outputs=None)
|
165 |
dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|
166 |
|
167 |
with gr.TabItem("Youtube"): # tab2
|
modules/whisper/faster_whisper_inference.py
CHANGED
@@ -9,11 +9,12 @@ import ctranslate2
|
|
9 |
import whisper
|
10 |
import gradio as gr
|
11 |
from argparse import Namespace
|
12 |
-
#import spaces
|
13 |
|
14 |
from modules.whisper.whisper_parameter import *
|
15 |
from modules.whisper.whisper_base import WhisperBase
|
16 |
|
|
|
|
|
17 |
|
18 |
class FasterWhisperInference(WhisperBase):
|
19 |
def __init__(self,
|
@@ -159,6 +160,11 @@ class FasterWhisperInference(WhisperBase):
|
|
159 |
else:
|
160 |
return "cpu"
|
161 |
|
|
|
|
|
|
|
|
|
|
|
162 |
@staticmethod
|
163 |
def download_model(model_size: str, model_dir: str):
|
164 |
print(f"\nDownloading \"{model_size}\" to \"{model_dir}\"..\n")
|
|
|
9 |
import whisper
|
10 |
import gradio as gr
|
11 |
from argparse import Namespace
|
|
|
12 |
|
13 |
from modules.whisper.whisper_parameter import *
|
14 |
from modules.whisper.whisper_base import WhisperBase
|
15 |
|
16 |
+
# ZeroGPU
|
17 |
+
import spaces
|
18 |
|
19 |
class FasterWhisperInference(WhisperBase):
|
20 |
def __init__(self,
|
|
|
160 |
else:
|
161 |
return "cpu"
|
162 |
|
163 |
+
@staticmethod
|
164 |
+
@spaces.GPU(duration=120)
|
165 |
+
def test():
|
166 |
+
print("\nWHAT Happend?\n")
|
167 |
+
|
168 |
@staticmethod
|
169 |
def download_model(model_size: str, model_dir: str):
|
170 |
print(f"\nDownloading \"{model_size}\" to \"{model_dir}\"..\n")
|