Spaces:
Running
on
Zero
Running
on
Zero
update
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ pipe_dict = {
|
|
36 |
k: pipeline(
|
37 |
"automatic-speech-recognition",
|
38 |
model=v,
|
39 |
-
device="cuda" if torch.cuda.is_available()
|
40 |
)
|
41 |
for k, v in model_dict.items()
|
42 |
}
|
@@ -82,9 +82,10 @@ def transcribe_galgame_whisper(audio) -> tuple[str, float]:
|
|
82 |
return transcribe_common(audio, "galgame-whisper-wip")
|
83 |
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
88 |
|
89 |
initial_md = """
|
90 |
# Galgame-Whisper (WIP) Demo
|
@@ -143,8 +144,7 @@ with gr.Blocks() as app:
|
|
143 |
time_kotoba_v2 = gr.Textbox(label="Time taken")
|
144 |
output_kotoba_v2 = gr.Textbox(label="Result")
|
145 |
|
146 |
-
|
147 |
-
refresh_button = gr.Button("Refresh Status") # Create a refresh button
|
148 |
|
149 |
button_v2.click(transcribe_large_v2, inputs=audio, outputs=[output_v2, time_v2])
|
150 |
button_v3.click(transcribe_large_v3, inputs=audio, outputs=[output_v3, time_v3])
|
@@ -164,4 +164,6 @@ with gr.Blocks() as app:
|
|
164 |
inputs=audio,
|
165 |
outputs=[output_galgame, time_galgame],
|
166 |
)
|
|
|
|
|
167 |
app.launch(inbrowser=True)
|
|
|
36 |
k: pipeline(
|
37 |
"automatic-speech-recognition",
|
38 |
model=v,
|
39 |
+
device="cuda" if torch.cuda.is_available() else "cpu",
|
40 |
)
|
41 |
for k, v in model_dict.items()
|
42 |
}
|
|
|
82 |
return transcribe_common(audio, "galgame-whisper-wip")
|
83 |
|
84 |
|
85 |
+
def warmup():
|
86 |
+
logger.info("Warm-up...")
|
87 |
+
return transcribe_large_v3_turbo("test.wav")
|
88 |
+
|
89 |
|
90 |
initial_md = """
|
91 |
# Galgame-Whisper (WIP) Demo
|
|
|
144 |
time_kotoba_v2 = gr.Textbox(label="Time taken")
|
145 |
output_kotoba_v2 = gr.Textbox(label="Result")
|
146 |
|
147 |
+
warmup_result = gr.Textbox(label="Warm-up result", visible=False)
|
|
|
148 |
|
149 |
button_v2.click(transcribe_large_v2, inputs=audio, outputs=[output_v2, time_v2])
|
150 |
button_v3.click(transcribe_large_v3, inputs=audio, outputs=[output_v3, time_v3])
|
|
|
164 |
inputs=audio,
|
165 |
outputs=[output_galgame, time_galgame],
|
166 |
)
|
167 |
+
|
168 |
+
app.load(warmup, inputs=[], outputs=[warmup_result], queue=True)
|
169 |
app.launch(inbrowser=True)
|