Update app.py
Browse files
app.py
CHANGED
|
@@ -11,8 +11,14 @@ pipe1 = pipeline("automatic-speech-recognition", model="openai/whisper-base")
|
|
| 11 |
#pipe3.to("cuda" if torch.cuda.is_available() else "cpu")
|
| 12 |
|
| 13 |
def audio_to_image(audio):
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
transcription_text = transcription['text']
|
| 18 |
|
|
|
|
| 11 |
#pipe3.to("cuda" if torch.cuda.is_available() else "cpu")
|
| 12 |
|
| 13 |
def audio_to_image(audio):
|
| 14 |
+
# Load the audio file and convert it to a numpy array
|
| 15 |
+
audio_data, _ = sf.read(audio) # Load audio file
|
| 16 |
+
audio_array = np.array(audio_data) # Convert to numpy array
|
| 17 |
|
| 18 |
+
# Transcribe the audio input
|
| 19 |
+
transcription = pipe1(audio_array)
|
| 20 |
+
|
| 21 |
+
#transcription = pipe1(audio)
|
| 22 |
|
| 23 |
transcription_text = transcription['text']
|
| 24 |
|