Commit
·
3ab9d21
1
Parent(s):
887ef01
use gradio textbox
Browse files- app.py +2 -6
- src/transcriber.py +1 -1
app.py
CHANGED
@@ -1,9 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
from src.transcriber import transcriber
|
3 |
-
import os
|
4 |
-
|
5 |
-
# os.environ["GRADIO_TEMP_DIR"] = os.path.join(os.getcwd(), "tmp")
|
6 |
-
# os.environ["HF_HOME"] = os.path.join(os.getcwd(), "hf_tmp")
|
7 |
|
8 |
|
9 |
def main():
|
@@ -23,7 +19,7 @@ def main():
|
|
23 |
text_output = gr.Textbox(label="SRT Text transcription")
|
24 |
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
25 |
text_clean_output = gr.Textbox(label="Text transcription")
|
26 |
-
json_output = gr.
|
27 |
gr.Interface(
|
28 |
fn=transcriber,
|
29 |
inputs=[file, file_type, max_words_per_line, task, model_version],
|
@@ -42,7 +38,7 @@ def main():
|
|
42 |
text_output = gr.Textbox(label="SRT Text transcription")
|
43 |
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
44 |
text_clean_output = gr.Textbox(label="Text transcription")
|
45 |
-
json_output = gr.
|
46 |
gr.Interface(
|
47 |
fn=transcriber,
|
48 |
inputs=[file, file_type, max_words_per_line, task, model_version],
|
|
|
1 |
import gradio as gr
|
2 |
from src.transcriber import transcriber
|
|
|
|
|
|
|
|
|
3 |
|
4 |
|
5 |
def main():
|
|
|
19 |
text_output = gr.Textbox(label="SRT Text transcription")
|
20 |
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
21 |
text_clean_output = gr.Textbox(label="Text transcription")
|
22 |
+
json_output = gr.Textbox(label="JSON Transcription")
|
23 |
gr.Interface(
|
24 |
fn=transcriber,
|
25 |
inputs=[file, file_type, max_words_per_line, task, model_version],
|
|
|
38 |
text_output = gr.Textbox(label="SRT Text transcription")
|
39 |
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
40 |
text_clean_output = gr.Textbox(label="Text transcription")
|
41 |
+
json_output = gr.Textbox(label="JSON Transcription")
|
42 |
gr.Interface(
|
43 |
fn=transcriber,
|
44 |
inputs=[file, file_type, max_words_per_line, task, model_version],
|
src/transcriber.py
CHANGED
@@ -64,7 +64,7 @@ def write_srt(segments, max_words_per_line, srt_path):
|
|
64 |
words_in_line = []
|
65 |
|
66 |
file.write(result)
|
67 |
-
return result, srt_path, " ".join(result_clean), json_output
|
68 |
|
69 |
|
70 |
def transcriber(file_input:gr.File,
|
|
|
64 |
words_in_line = []
|
65 |
|
66 |
file.write(result)
|
67 |
+
return result, srt_path, " ".join(result_clean), str(json_output)
|
68 |
|
69 |
|
70 |
def transcriber(file_input:gr.File,
|