srinivasmmw2024 commited on
Commit
1293ab7
·
verified ·
1 Parent(s): 90d7c67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
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
- if __name__ == "__main__":
27
- audio_file_path = "CAR0005.mp3"
28
- transcription = transcribe_audio(audio_file_path)
29
- print("Transcription:", transcription)
 
 
 
 
 
 
 
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)