kabita-choudhary commited on
Commit
ac543ab
1 Parent(s): 379e1ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -2,8 +2,8 @@ import gradio as gr
2
  import pandas as pd
3
  from pydub import AudioSegment
4
  from pyannote.audio import Pipeline
5
- from transformers import pipeline
6
- whisper = pipeline('automatic-speech-recognition', model = 'openai/whisper-medium', device = 0)
7
  pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization",use_auth_token="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")
8
  def diarization(inp_audio):
9
  diarization = pipeline(inp_audio)
@@ -35,8 +35,10 @@ def generatetext(filename,starttime,endtime):
35
  newAudio = AudioSegment.from_wav(filename)
36
  a = newAudio[t1:t2]
37
  a.export('audio.wav', format="wav")
38
- text1 = whisper('audio.wav')
39
- return text1.get("text")
 
 
40
 
41
  block = gr.Blocks()
42
  with block:
 
2
  import pandas as pd
3
  from pydub import AudioSegment
4
  from pyannote.audio import Pipeline
5
+ import whisper
6
+ model = whisper.load_model("medium")
7
  pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization",use_auth_token="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")
8
  def diarization(inp_audio):
9
  diarization = pipeline(inp_audio)
 
35
  newAudio = AudioSegment.from_wav(filename)
36
  a = newAudio[t1:t2]
37
  a.export('audio.wav', format="wav")
38
+ audio = whisper.load_audio('audio.wav')
39
+ result= model.transcribe(audio)
40
+ #text1 = whisper('audio.wav')
41
+ return result.get("text")
42
 
43
  block = gr.Blocks()
44
  with block: