Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,13 +14,13 @@ def transcribe_audio(audio_bytes):
|
|
14 |
model = AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-large")
|
15 |
audio_array = np.frombuffer(audio_bytes, dtype=np.int16)
|
16 |
audio_tensor = torch.tensor(audio_array, dtype=torch.float64) / 32768.0
|
17 |
-
|
18 |
-
logits = model(
|
19 |
predicted_ids = torch.argmax(logits, dim=-1)
|
20 |
transcription = processor.decode(predicted_ids[0])
|
21 |
return transcription
|
22 |
|
23 |
-
|
24 |
# Streamlit app
|
25 |
st.title("Audio to Text Transcription..")
|
26 |
|
|
|
14 |
model = AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-large")
|
15 |
audio_array = np.frombuffer(audio_bytes, dtype=np.int16)
|
16 |
audio_tensor = torch.tensor(audio_array, dtype=torch.float64) / 32768.0
|
17 |
+
inputs = processor(feature_extractor=audio_tensor, sampling_rate=16000, return_tensors="pt")
|
18 |
+
logits = model(**inputs).logits
|
19 |
predicted_ids = torch.argmax(logits, dim=-1)
|
20 |
transcription = processor.decode(predicted_ids[0])
|
21 |
return transcription
|
22 |
|
23 |
+
|
24 |
# Streamlit app
|
25 |
st.title("Audio to Text Transcription..")
|
26 |
|