Commit
·
ba81a65
1
Parent(s):
3ab9d21
use json dumps for properjson serialization
Browse files- app.py +2 -2
- src/transcriber.py +2 -2
app.py
CHANGED
|
@@ -19,7 +19,7 @@ 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.
|
| 23 |
gr.Interface(
|
| 24 |
fn=transcriber,
|
| 25 |
inputs=[file, file_type, max_words_per_line, task, model_version],
|
|
@@ -38,7 +38,7 @@ def main():
|
|
| 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.
|
| 42 |
gr.Interface(
|
| 43 |
fn=transcriber,
|
| 44 |
inputs=[file, file_type, max_words_per_line, task, model_version],
|
|
|
|
| 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.JSON(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.JSON(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
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import os
|
| 2 |
import gradio as gr
|
| 3 |
from faster_whisper import WhisperModel
|
| 4 |
from moviepy.editor import VideoFileClip
|
|
@@ -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),
|
| 68 |
|
| 69 |
|
| 70 |
def transcriber(file_input:gr.File,
|
|
|
|
| 1 |
+
import os, json
|
| 2 |
import gradio as gr
|
| 3 |
from faster_whisper import WhisperModel
|
| 4 |
from moviepy.editor import VideoFileClip
|
|
|
|
| 64 |
words_in_line = []
|
| 65 |
|
| 66 |
file.write(result)
|
| 67 |
+
return result, srt_path, " ".join(result_clean), json.dumps(json_output)
|
| 68 |
|
| 69 |
|
| 70 |
def transcriber(file_input:gr.File,
|