Spaces:
Running
Running
Parth Bhangla
commited on
Commit
·
d4c6b5f
1
Parent(s):
b304574
RemovedTextBox - Rename File
Browse files
app.py
CHANGED
@@ -62,15 +62,7 @@ def load_model_and_predict(
|
|
62 |
}
|
63 |
|
64 |
prediction = model_state["loaded_model"](audio_in)["text"]
|
65 |
-
return
|
66 |
-
prediction,
|
67 |
-
model_state,
|
68 |
-
gr.Textbox(
|
69 |
-
label=TEXTGRID_NAME_INPUT_LABEL,
|
70 |
-
interactive=True,
|
71 |
-
value=Path(audio_in).with_suffix(".TextGrid").name,
|
72 |
-
),
|
73 |
-
)
|
74 |
except Exception as e:
|
75 |
raise gr.Error(f"Failed to load model: {str(e)}")
|
76 |
|
@@ -212,7 +204,6 @@ def launch_demo():
|
|
212 |
full_prediction = gr.Textbox(label="IPA Transcription", show_copy_button=True)
|
213 |
|
214 |
full_textgrid_tier = gr.Textbox(label="TextGrid Tier Name", value="transcription", interactive=True)
|
215 |
-
full_textgrid_filename = gr.Textbox(label=TEXTGRID_NAME_INPUT_LABEL, interactive=False)
|
216 |
|
217 |
full_textgrid_contents = gr.Textbox(label="TextGrid Contents", show_copy_button=True)
|
218 |
full_download_btn = gr.DownloadButton(label=TEXTGRID_DOWNLOAD_TEXT, interactive=False, variant="primary")
|
@@ -251,7 +242,7 @@ def launch_demo():
|
|
251 |
full_transcribe_btn.click(
|
252 |
fn=load_model_and_predict,
|
253 |
inputs=[model_name, full_audio, model_state],
|
254 |
-
outputs=[full_prediction, model_state
|
255 |
)
|
256 |
|
257 |
full_prediction.change(
|
@@ -261,14 +252,18 @@ def launch_demo():
|
|
261 |
)
|
262 |
|
263 |
full_textgrid_contents.change(
|
264 |
-
fn=get_interactive_download_button
|
265 |
-
|
|
|
|
|
|
|
266 |
outputs=[full_download_btn],
|
267 |
)
|
268 |
|
|
|
269 |
full_reset_btn.click(
|
270 |
fn=lambda: (None, "", "", "", gr.update(interactive=False)),
|
271 |
-
outputs=[full_audio, full_prediction,
|
272 |
)
|
273 |
|
274 |
# Enable interval transcribe button only when both files are uploaded
|
|
|
62 |
}
|
63 |
|
64 |
prediction = model_state["loaded_model"](audio_in)["text"]
|
65 |
+
return prediction, model_state
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
except Exception as e:
|
67 |
raise gr.Error(f"Failed to load model: {str(e)}")
|
68 |
|
|
|
204 |
full_prediction = gr.Textbox(label="IPA Transcription", show_copy_button=True)
|
205 |
|
206 |
full_textgrid_tier = gr.Textbox(label="TextGrid Tier Name", value="transcription", interactive=True)
|
|
|
207 |
|
208 |
full_textgrid_contents = gr.Textbox(label="TextGrid Contents", show_copy_button=True)
|
209 |
full_download_btn = gr.DownloadButton(label=TEXTGRID_DOWNLOAD_TEXT, interactive=False, variant="primary")
|
|
|
242 |
full_transcribe_btn.click(
|
243 |
fn=load_model_and_predict,
|
244 |
inputs=[model_name, full_audio, model_state],
|
245 |
+
outputs=[full_prediction, model_state],
|
246 |
)
|
247 |
|
248 |
full_prediction.change(
|
|
|
252 |
)
|
253 |
|
254 |
full_textgrid_contents.change(
|
255 |
+
fn=lambda tg_text, audio_path: get_interactive_download_button(
|
256 |
+
tg_text,
|
257 |
+
Path(audio_path).with_suffix(".TextGrid").name if audio_path else "output.TextGrid"
|
258 |
+
),
|
259 |
+
inputs=[full_textgrid_contents, full_audio],
|
260 |
outputs=[full_download_btn],
|
261 |
)
|
262 |
|
263 |
+
|
264 |
full_reset_btn.click(
|
265 |
fn=lambda: (None, "", "", "", gr.update(interactive=False)),
|
266 |
+
outputs=[full_audio, full_prediction, full_textgrid_contents, full_download_btn],
|
267 |
)
|
268 |
|
269 |
# Enable interval transcribe button only when both files are uploaded
|