Commit
·
780225d
1
Parent(s):
0847d61
change interface to button
Browse files
app.py
CHANGED
|
@@ -9,7 +9,6 @@ def main():
|
|
| 9 |
with gr.Tab("Video", id="video"):
|
| 10 |
file = gr.File(file_types=["video"],type="filepath", label="Upload a video")
|
| 11 |
file_type = gr.Radio(choices=["video"], value="video", label="File Type", visible=False)
|
| 12 |
-
print(file_type)
|
| 13 |
max_words_per_line = gr.Number(value=6, label="Max words per line")
|
| 14 |
task = gr.Radio(choices=["transcribe", "translate"], value="transcribe", label="Select Task")
|
| 15 |
model_version = gr.Radio(choices=["deepdml/faster-whisper-large-v3-turbo-ct2",
|
|
@@ -18,10 +17,12 @@ def main():
|
|
| 18 |
text_output = gr.Textbox(label="SRT Text transcription")
|
| 19 |
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
| 20 |
text_clean_output = gr.Textbox(label="Text transcription")
|
| 21 |
-
gr.
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
| 25 |
|
| 26 |
with gr.Tab("Audio", id = "audio"):
|
| 27 |
file = gr.File(file_types=["audio"],type="filepath", label="Upload an audio file")
|
|
@@ -34,10 +35,12 @@ def main():
|
|
| 34 |
text_output = gr.Textbox(label="SRT Text transcription")
|
| 35 |
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
| 36 |
text_clean_output = gr.Textbox(label="Text transcription")
|
| 37 |
-
gr.
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
demo.launch()
|
| 42 |
|
| 43 |
if __name__ == '__main__':
|
|
|
|
| 9 |
with gr.Tab("Video", id="video"):
|
| 10 |
file = gr.File(file_types=["video"],type="filepath", label="Upload a video")
|
| 11 |
file_type = gr.Radio(choices=["video"], value="video", label="File Type", visible=False)
|
|
|
|
| 12 |
max_words_per_line = gr.Number(value=6, label="Max words per line")
|
| 13 |
task = gr.Radio(choices=["transcribe", "translate"], value="transcribe", label="Select Task")
|
| 14 |
model_version = gr.Radio(choices=["deepdml/faster-whisper-large-v3-turbo-ct2",
|
|
|
|
| 17 |
text_output = gr.Textbox(label="SRT Text transcription")
|
| 18 |
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
| 19 |
text_clean_output = gr.Textbox(label="Text transcription")
|
| 20 |
+
transcribe_btn = gr.Button(value="Transcribe")
|
| 21 |
+
transcribe_btn.click(
|
| 22 |
+
fn=transcriber,
|
| 23 |
+
inputs=[file, file_type, max_words_per_line, task, model_version],
|
| 24 |
+
outputs=[text_output, srt_file, text_clean_output]
|
| 25 |
+
)
|
| 26 |
|
| 27 |
with gr.Tab("Audio", id = "audio"):
|
| 28 |
file = gr.File(file_types=["audio"],type="filepath", label="Upload an audio file")
|
|
|
|
| 35 |
text_output = gr.Textbox(label="SRT Text transcription")
|
| 36 |
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
| 37 |
text_clean_output = gr.Textbox(label="Text transcription")
|
| 38 |
+
transcribe_btn = gr.Button(value="Transcribe")
|
| 39 |
+
transcribe_btn.click(
|
| 40 |
+
fn=transcriber,
|
| 41 |
+
inputs=[file, file_type, max_words_per_line, task, model_version],
|
| 42 |
+
outputs=[text_output, srt_file, text_clean_output]
|
| 43 |
+
)
|
| 44 |
demo.launch()
|
| 45 |
|
| 46 |
if __name__ == '__main__':
|