Update app.py
Browse files
app.py
CHANGED
|
@@ -340,7 +340,7 @@ class App:
|
|
| 340 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
| 341 |
inputs=params + whisper_params.as_list(),
|
| 342 |
outputs=[tb_indicator, files_subtitles, tb_info])
|
| 343 |
-
btn_run.click(fn=self.update_dataframe,inputs=[cb_timestamp_preview,cb_diarize
|
| 344 |
|
| 345 |
# btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
| 346 |
|
|
@@ -391,7 +391,21 @@ class App:
|
|
| 391 |
return gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)
|
| 392 |
|
| 393 |
@staticmethod
|
| 394 |
-
def update_dataframe(value_cb_timestamp_preview,value_cb_diarize,value_input_multi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
|
| 396 |
temp = dataframe_data
|
| 397 |
print("test df data: ")
|
|
@@ -407,17 +421,6 @@ class App:
|
|
| 407 |
new_data_rows = [[1,2],[3,4]]
|
| 408 |
updated_data = {"headers": new_headers, "data": new_data_rows}
|
| 409 |
return gr.update(value=updated_data)
|
| 410 |
-
|
| 411 |
-
if value_cb_timestamp_preview==True and value_cb_diarize==True:
|
| 412 |
-
return gr.Dataframe(headers=["Time","Speaker","Text","Download"],column_widths=["10%","15%","50%","20%"],datatype=["str","str","markdown","html"])
|
| 413 |
-
elif value_cb_timestamp_preview==True and value_cb_diarize==False:
|
| 414 |
-
return gr.Dataframe(headers=["Time","Text","Download"],column_widths=["10%","65%","20%"],datatype=["str","markdown","html"])
|
| 415 |
-
elif value_cb_timestamp_preview==False and value_cb_diarize==True:
|
| 416 |
-
return gr.Dataframe(headers=["Speaker","Text","Download"],column_widths=["15%","60%","20%"],datatype=["str","markdown","html"])
|
| 417 |
-
elif value_cb_timestamp_preview==False and value_cb_diarize==False:
|
| 418 |
-
return gr.Dataframe(headers=["Text","Download"],column_widths=["75%","20%"],datatype=["markdown","html"])
|
| 419 |
-
else:
|
| 420 |
-
return gr.Dataframe(headers=["Text","Download"],column_widths=["75%","20%"],datatype=["markdown","html"])
|
| 421 |
|
| 422 |
# Create the parser for command-line arguments
|
| 423 |
parser = argparse.ArgumentParser()
|
|
|
|
| 340 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
| 341 |
inputs=params + whisper_params.as_list(),
|
| 342 |
outputs=[tb_indicator, files_subtitles, tb_info])
|
| 343 |
+
btn_run.click(fn=self.update_dataframe,inputs=[cb_timestamp_preview,cb_diarize],outputs=tb_indicator)
|
| 344 |
|
| 345 |
# btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
| 346 |
|
|
|
|
| 391 |
return gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)
|
| 392 |
|
| 393 |
@staticmethod
|
| 394 |
+
def update_dataframe(value_cb_timestamp_preview,value_cb_diarize,value_input_multi):
|
| 395 |
+
|
| 396 |
+
if value_cb_timestamp_preview==True and value_cb_diarize==True:
|
| 397 |
+
return gr.Dataframe(headers=["Time","Speaker","Text"],column_widths=["10%","15%","70%"],datatype=["str","str","markdown"])
|
| 398 |
+
elif value_cb_timestamp_preview==True and value_cb_diarize==False:
|
| 399 |
+
return gr.Dataframe(headers=["Time","Text"],column_widths=["10%","85%"],datatype=["str","markdown")
|
| 400 |
+
elif value_cb_timestamp_preview==False and value_cb_diarize==True:
|
| 401 |
+
return gr.Dataframe(headers=["Speaker","Text"],column_widths=["15%","80%"],datatype=["str","markdown"])
|
| 402 |
+
elif value_cb_timestamp_preview==False and value_cb_diarize==False:
|
| 403 |
+
return gr.Dataframe(headers=["Text"],column_widths=["95%"],datatype=["markdown"])
|
| 404 |
+
else:
|
| 405 |
+
return gr.Dataframe(headers=["Text"],column_widths=["95%"],datatype=["markdown"])
|
| 406 |
+
|
| 407 |
+
@staticmethod
|
| 408 |
+
def update_dataframe_column(dataframe_data,list_files):
|
| 409 |
|
| 410 |
temp = dataframe_data
|
| 411 |
print("test df data: ")
|
|
|
|
| 421 |
new_data_rows = [[1,2],[3,4]]
|
| 422 |
updated_data = {"headers": new_headers, "data": new_data_rows}
|
| 423 |
return gr.update(value=updated_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
|
| 425 |
# Create the parser for command-line arguments
|
| 426 |
parser = argparse.ArgumentParser()
|