jawadrashid commited on
Commit
77d4fb9
1 Parent(s): 01d9054

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -13,9 +13,21 @@ def transcribe_speech(filepath):
13
  output = transcriber (filepath)
14
  return output["text"]
15
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  mic_transcribe = gr.Interface(
18
- fn=transcribe_speech,
19
  inputs=gr.Audio(sources="microphone",
20
  type="filepath"),
21
  outputs=gr.Textbox(label="Transcription",
@@ -23,7 +35,7 @@ mic_transcribe = gr.Interface(
23
  allow_flagging="never")
24
 
25
  file_transcribe = gr.Interface(
26
- fn=transcribe_speech,
27
  inputs=gr.Audio(sources="upload",
28
  type="filepath"),
29
  outputs=gr.Textbox(label="Transcription",
 
13
  output = transcriber (filepath)
14
  return output["text"]
15
 
16
+ def transcribe_long_form(filepath):
17
+ if filepath is None:
18
+ gr.Warning("No audio found, please retry.")
19
+ return ""
20
+ output = transcriber(
21
+ filepath,
22
+ max_new_tokens=256,
23
+ chunk_length_s=30,
24
+ batch_size=8,
25
+ )
26
+ return output["text"]
27
+
28
 
29
  mic_transcribe = gr.Interface(
30
+ fn=transcribe_long_form,
31
  inputs=gr.Audio(sources="microphone",
32
  type="filepath"),
33
  outputs=gr.Textbox(label="Transcription",
 
35
  allow_flagging="never")
36
 
37
  file_transcribe = gr.Interface(
38
+ fn=transcribe_long_form,
39
  inputs=gr.Audio(sources="upload",
40
  type="filepath"),
41
  outputs=gr.Textbox(label="Transcription",