Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import torch
|
2 |
from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
|
3 |
import soundfile as sf
|
|
|
4 |
|
5 |
# Load the processor and model
|
6 |
processor = Wav2Vec2Processor.from_pretrained("openbmb/MiniCPM-o-2_6")
|
@@ -23,7 +24,13 @@ def transcribe_audio(file_path):
|
|
23 |
|
24 |
return transcription[0]
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import torch
|
2 |
from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
|
3 |
import soundfile as sf
|
4 |
+
import streamlit as st
|
5 |
|
6 |
# Load the processor and model
|
7 |
processor = Wav2Vec2Processor.from_pretrained("openbmb/MiniCPM-o-2_6")
|
|
|
24 |
|
25 |
return transcription[0]
|
26 |
|
27 |
+
uploaded_file = st.file_uploader("Upload an audio", type=["mp3", "wav"])
|
28 |
+
|
29 |
+
if uploaded_file is not None:
|
30 |
+
transcription = transcribe_audio(uploaded_file)
|
31 |
+
st.write(transcription)
|
32 |
+
|
33 |
+
# if __name__ == "__main__":
|
34 |
+
# audio_file_path = "CAR0005.mp3"
|
35 |
+
# transcription = transcribe_audio(audio_file_path)
|
36 |
+
# print("Transcription:", transcription)
|