Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@ footer {
|
|
24 |
}
|
25 |
'''
|
26 |
|
27 |
-
@spaces.GPU(15)
|
28 |
def transcribe(inputs, task):
|
29 |
if inputs is None: raise gr.Error("Invalid input.")
|
30 |
output = repo(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)["text"]
|
@@ -40,14 +40,14 @@ with gr.Blocks(css=css) as main:
|
|
40 |
|
41 |
with gr.Column():
|
42 |
input = gr.Audio(sources="upload", type="filepath", label="Input"),
|
43 |
-
|
44 |
submit = gr.Button("▶")
|
45 |
maintain = gr.Button("☁️")
|
46 |
|
47 |
with gr.Column():
|
48 |
output = gr.Textbox(lines=1, value=DEFAULT_INPUT, label="Output")
|
49 |
|
50 |
-
submit.click(transcribe, inputs=[input,
|
51 |
-
maintain.click(
|
52 |
|
53 |
main.launch(show_api=True)
|
|
|
24 |
}
|
25 |
'''
|
26 |
|
27 |
+
@spaces.GPU(duration=15)
|
28 |
def transcribe(inputs, task):
|
29 |
if inputs is None: raise gr.Error("Invalid input.")
|
30 |
output = repo(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)["text"]
|
|
|
40 |
|
41 |
with gr.Column():
|
42 |
input = gr.Audio(sources="upload", type="filepath", label="Input"),
|
43 |
+
task = gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
44 |
submit = gr.Button("▶")
|
45 |
maintain = gr.Button("☁️")
|
46 |
|
47 |
with gr.Column():
|
48 |
output = gr.Textbox(lines=1, value=DEFAULT_INPUT, label="Output")
|
49 |
|
50 |
+
submit.click(transcribe, inputs=[input, task], outputs=[output], queue=False)
|
51 |
+
maintain.click(fcloud, inputs=[], outputs=[], queue=False)
|
52 |
|
53 |
main.launch(show_api=True)
|