Spaces:
Running
Running
jhj0517
commited on
Commit
β’
d2ebfa4
1
Parent(s):
4531a09
add `Files` to output
Browse files
app.py
CHANGED
@@ -44,7 +44,7 @@ class App:
|
|
44 |
with gr.Tabs():
|
45 |
with gr.TabItem("File"): # tab1
|
46 |
with gr.Row():
|
47 |
-
input_file = gr.Files(type="
|
48 |
with gr.Row():
|
49 |
dd_model = gr.Dropdown(choices=self.whisper_inf.available_models, value="large-v3",
|
50 |
label="Model")
|
@@ -63,14 +63,15 @@ class App:
|
|
63 |
with gr.Row():
|
64 |
btn_run = gr.Button("GENERATE SUBTITLE FILE", variant="primary")
|
65 |
with gr.Row():
|
66 |
-
tb_indicator = gr.Textbox(label="Output", scale=
|
67 |
-
|
|
|
68 |
|
69 |
params = [input_file, dd_model, dd_lang, dd_file_format, cb_translate, cb_timestamp]
|
70 |
advanced_params = [nb_beam_size, nb_log_prob_threshold, nb_no_speech_threshold, dd_compute_type]
|
71 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
72 |
inputs=params + advanced_params,
|
73 |
-
outputs=[tb_indicator])
|
74 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
75 |
dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|
76 |
|
@@ -102,14 +103,15 @@ class App:
|
|
102 |
with gr.Row():
|
103 |
btn_run = gr.Button("GENERATE SUBTITLE FILE", variant="primary")
|
104 |
with gr.Row():
|
105 |
-
tb_indicator = gr.Textbox(label="Output", scale=
|
106 |
-
|
|
|
107 |
|
108 |
params = [tb_youtubelink, dd_model, dd_lang, dd_file_format, cb_translate, cb_timestamp]
|
109 |
advanced_params = [nb_beam_size, nb_log_prob_threshold, nb_no_speech_threshold, dd_compute_type]
|
110 |
btn_run.click(fn=self.whisper_inf.transcribe_youtube,
|
111 |
inputs=params + advanced_params,
|
112 |
-
outputs=[tb_indicator])
|
113 |
tb_youtubelink.change(get_ytmetas, inputs=[tb_youtubelink],
|
114 |
outputs=[img_thumbnail, tb_title, tb_description])
|
115 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
@@ -134,20 +136,21 @@ class App:
|
|
134 |
with gr.Row():
|
135 |
btn_run = gr.Button("GENERATE SUBTITLE FILE", variant="primary")
|
136 |
with gr.Row():
|
137 |
-
tb_indicator = gr.Textbox(label="Output", scale=
|
138 |
-
|
|
|
139 |
|
140 |
params = [mic_input, dd_model, dd_lang, dd_file_format, cb_translate]
|
141 |
advanced_params = [nb_beam_size, nb_log_prob_threshold, nb_no_speech_threshold, dd_compute_type]
|
142 |
btn_run.click(fn=self.whisper_inf.transcribe_mic,
|
143 |
inputs=params + advanced_params,
|
144 |
-
outputs=[tb_indicator])
|
145 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
146 |
dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|
147 |
|
148 |
with gr.TabItem("T2T Translation"): # tab 4
|
149 |
with gr.Row():
|
150 |
-
file_subs = gr.Files(type="
|
151 |
file_types=['.vtt', '.srt'])
|
152 |
|
153 |
with gr.TabItem("NLLB"): # sub tab1
|
@@ -164,14 +167,16 @@ class App:
|
|
164 |
with gr.Row():
|
165 |
btn_run = gr.Button("TRANSLATE SUBTITLE FILE", variant="primary")
|
166 |
with gr.Row():
|
167 |
-
tb_indicator = gr.Textbox(label="Output", scale=
|
168 |
-
|
|
|
169 |
with gr.Column():
|
170 |
md_vram_table = gr.HTML(NLLB_VRAM_TABLE, elem_id="md_nllb_vram_table")
|
171 |
|
172 |
btn_run.click(fn=self.nllb_inf.translate_file,
|
173 |
inputs=[file_subs, dd_nllb_model, dd_nllb_sourcelang, dd_nllb_targetlang, cb_timestamp],
|
174 |
-
outputs=[tb_indicator])
|
|
|
175 |
btn_openfolder.click(fn=lambda: self.open_folder(os.path.join("outputs", "translations")),
|
176 |
inputs=None,
|
177 |
outputs=None)
|
|
|
44 |
with gr.Tabs():
|
45 |
with gr.TabItem("File"): # tab1
|
46 |
with gr.Row():
|
47 |
+
input_file = gr.Files(type="filepath", label="Upload File here")
|
48 |
with gr.Row():
|
49 |
dd_model = gr.Dropdown(choices=self.whisper_inf.available_models, value="large-v3",
|
50 |
label="Model")
|
|
|
63 |
with gr.Row():
|
64 |
btn_run = gr.Button("GENERATE SUBTITLE FILE", variant="primary")
|
65 |
with gr.Row():
|
66 |
+
tb_indicator = gr.Textbox(label="Output", scale=4)
|
67 |
+
files_subtitles = gr.Files(label="Downloadable output file", scale=4, interactive=False)
|
68 |
+
btn_openfolder = gr.Button('π', scale=1)
|
69 |
|
70 |
params = [input_file, dd_model, dd_lang, dd_file_format, cb_translate, cb_timestamp]
|
71 |
advanced_params = [nb_beam_size, nb_log_prob_threshold, nb_no_speech_threshold, dd_compute_type]
|
72 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
73 |
inputs=params + advanced_params,
|
74 |
+
outputs=[tb_indicator, files_subtitles])
|
75 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
76 |
dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|
77 |
|
|
|
103 |
with gr.Row():
|
104 |
btn_run = gr.Button("GENERATE SUBTITLE FILE", variant="primary")
|
105 |
with gr.Row():
|
106 |
+
tb_indicator = gr.Textbox(label="Output", scale=4)
|
107 |
+
files_subtitles = gr.Files(label="Downloadable output file", scale=4)
|
108 |
+
btn_openfolder = gr.Button('π', scale=1)
|
109 |
|
110 |
params = [tb_youtubelink, dd_model, dd_lang, dd_file_format, cb_translate, cb_timestamp]
|
111 |
advanced_params = [nb_beam_size, nb_log_prob_threshold, nb_no_speech_threshold, dd_compute_type]
|
112 |
btn_run.click(fn=self.whisper_inf.transcribe_youtube,
|
113 |
inputs=params + advanced_params,
|
114 |
+
outputs=[tb_indicator, files_subtitles])
|
115 |
tb_youtubelink.change(get_ytmetas, inputs=[tb_youtubelink],
|
116 |
outputs=[img_thumbnail, tb_title, tb_description])
|
117 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
|
|
136 |
with gr.Row():
|
137 |
btn_run = gr.Button("GENERATE SUBTITLE FILE", variant="primary")
|
138 |
with gr.Row():
|
139 |
+
tb_indicator = gr.Textbox(label="Output", scale=4)
|
140 |
+
files_subtitles = gr.Files(label="Downloadable output file", scale=4)
|
141 |
+
btn_openfolder = gr.Button('π', scale=1)
|
142 |
|
143 |
params = [mic_input, dd_model, dd_lang, dd_file_format, cb_translate]
|
144 |
advanced_params = [nb_beam_size, nb_log_prob_threshold, nb_no_speech_threshold, dd_compute_type]
|
145 |
btn_run.click(fn=self.whisper_inf.transcribe_mic,
|
146 |
inputs=params + advanced_params,
|
147 |
+
outputs=[tb_indicator, files_subtitles])
|
148 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
149 |
dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|
150 |
|
151 |
with gr.TabItem("T2T Translation"): # tab 4
|
152 |
with gr.Row():
|
153 |
+
file_subs = gr.Files(type="filepath", label="Upload Subtitle Files to translate here",
|
154 |
file_types=['.vtt', '.srt'])
|
155 |
|
156 |
with gr.TabItem("NLLB"): # sub tab1
|
|
|
167 |
with gr.Row():
|
168 |
btn_run = gr.Button("TRANSLATE SUBTITLE FILE", variant="primary")
|
169 |
with gr.Row():
|
170 |
+
tb_indicator = gr.Textbox(label="Output", scale=4)
|
171 |
+
files_subtitles = gr.Files(label="Downloadable output file", scale=4)
|
172 |
+
btn_openfolder = gr.Button('π', scale=1)
|
173 |
with gr.Column():
|
174 |
md_vram_table = gr.HTML(NLLB_VRAM_TABLE, elem_id="md_nllb_vram_table")
|
175 |
|
176 |
btn_run.click(fn=self.nllb_inf.translate_file,
|
177 |
inputs=[file_subs, dd_nllb_model, dd_nllb_sourcelang, dd_nllb_targetlang, cb_timestamp],
|
178 |
+
outputs=[tb_indicator, files_subtitles])
|
179 |
+
|
180 |
btn_openfolder.click(fn=lambda: self.open_folder(os.path.join("outputs", "translations")),
|
181 |
inputs=None,
|
182 |
outputs=None)
|