Madhuslista commited on
Commit
f1c43a8
1 Parent(s): 8ee91c9

Feature: Add capability to download transcript as a file

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. lib/media.py +1 -1
app.py CHANGED
@@ -55,6 +55,7 @@ def interface_creation():
55
  transcribe_out = gr.Textbox(label="Transcription")
56
  download_btn = gr.Button("Download Transcript")
57
  download_path = gr.Textbox(label="Download File Path")
 
58
 
59
  # audio_out.append(transcribe_inp[1])
60
 
@@ -70,7 +71,7 @@ def interface_creation():
70
 
71
  transcribe_btn.click(transcribe_audio, inputs=transcribe_inp, outputs=transcribe_out)
72
 
73
- download_btn.click(save_file, inputs=[transcribe_inp[1], transcribe_inp[2], transcribe_out], outputs=download_path)
74
 
75
  return interface
76
 
 
55
  transcribe_out = gr.Textbox(label="Transcription")
56
  download_btn = gr.Button("Download Transcript")
57
  download_path = gr.Textbox(label="Download File Path")
58
+ download_file = gr.File(label="Transcript File", file_types=["txt"])
59
 
60
  # audio_out.append(transcribe_inp[1])
61
 
 
71
 
72
  transcribe_btn.click(transcribe_audio, inputs=transcribe_inp, outputs=transcribe_out)
73
 
74
+ download_btn.click(save_file, inputs=[transcribe_inp[1], transcribe_inp[2], transcribe_out], outputs=[download_path, download_file])
75
 
76
  return interface
77
 
lib/media.py CHANGED
@@ -81,7 +81,7 @@ def save_file(audio_path, transcript_folder_path, text):
81
  with open(output_transcript_pathstr, "w") as f:
82
  f.write(text)
83
 
84
- return output_transcript_pathstr
85
 
86
 
87
  # -->> Execute <<----------------------
 
81
  with open(output_transcript_pathstr, "w") as f:
82
  f.write(text)
83
 
84
+ return output_transcript_pathstr, text
85
 
86
 
87
  # -->> Execute <<----------------------