AlexMo commited on
Commit
199a869
1 Parent(s): 399b64e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -9,7 +9,7 @@ model = whisper.load_model("base")
9
  # model = pipeline(model="AlexMo/FIFA_WC22_WINNER_LANGUAGE_MODEL")
10
  summarizer = pipeline("summarization")
11
 
12
- def transcribe(microphone, file_upload):
13
  warn_output = ""
14
  if (microphone is not None) and (file_upload is not None):
15
  warn_output = (
@@ -21,7 +21,7 @@ def transcribe(microphone, file_upload):
21
 
22
  file = microphone if microphone is not None else file_upload
23
 
24
- text = model(file)["text"]
25
 
26
  return warn_output + text
27
 
@@ -74,7 +74,7 @@ with gr.Blocks() as demo:
74
  result_button_summary_audio = gr.Button('2. Get a summary')
75
  output_text_summary_audio = gr.Textbox(placeholder='Summary of the audio file.', label='Summary')
76
 
77
- result_button_transcribe_audio.click(transcribe, inputs=input_audio, outputs=output_text_transcribe_audio)
78
  result_button_summary_audio.click(getSummary, inputs=output_text_transcribe_audio, outputs=output_text_summary_audio)
79
  with gr.Tab('Summary of Youtube video'):
80
  input_text_url = gr.Textbox(placeholder='Youtube video URL', label='URL')
 
9
  # model = pipeline(model="AlexMo/FIFA_WC22_WINNER_LANGUAGE_MODEL")
10
  summarizer = pipeline("summarization")
11
 
12
+ def transcribe_inp(microphone, file_upload):
13
  warn_output = ""
14
  if (microphone is not None) and (file_upload is not None):
15
  warn_output = (
 
21
 
22
  file = microphone if microphone is not None else file_upload
23
 
24
+ text = model.transcribe(file)["text"]
25
 
26
  return warn_output + text
27
 
 
74
  result_button_summary_audio = gr.Button('2. Get a summary')
75
  output_text_summary_audio = gr.Textbox(placeholder='Summary of the audio file.', label='Summary')
76
 
77
+ result_button_transcribe_audio.click(transcribe_inp, inputs=input_audio, outputs=output_text_transcribe_audio)
78
  result_button_summary_audio.click(getSummary, inputs=output_text_transcribe_audio, outputs=output_text_summary_audio)
79
  with gr.Tab('Summary of Youtube video'):
80
  input_text_url = gr.Textbox(placeholder='Youtube video URL', label='URL')