Spaces:
Build error
Build error
Commit
·
fdc4fd8
1
Parent(s):
ac543ab
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,18 +28,17 @@ def diarization(inp_audio):
|
|
| 28 |
|
| 29 |
|
| 30 |
def generatetext(filename,starttime,endtime):
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
audio = whisper.load_audio('audio.wav')
|
| 39 |
-
result= model.transcribe(audio)
|
| 40 |
#text1 = whisper('audio.wav')
|
| 41 |
-
|
| 42 |
-
|
|
|
|
| 43 |
block = gr.Blocks()
|
| 44 |
with block:
|
| 45 |
with gr.Group():
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
def generatetext(filename,starttime,endtime):
|
| 31 |
+
t1 = starttime * 1000 # works in milliseconds
|
| 32 |
+
t2 = endtime * 1000
|
| 33 |
+
newAudio = AudioSegment.from_wav(filename)
|
| 34 |
+
a = newAudio[t1:t2]
|
| 35 |
+
a.export('audio.wav', format="wav")
|
| 36 |
+
audio = whisper.load_audio('audio.wav')
|
| 37 |
+
result= model.transcribe(audio)
|
|
|
|
|
|
|
| 38 |
#text1 = whisper('audio.wav')
|
| 39 |
+
print(result)
|
| 40 |
+
print(result.get("text"))
|
| 41 |
+
return result.get("text")
|
| 42 |
block = gr.Blocks()
|
| 43 |
with block:
|
| 44 |
with gr.Group():
|