jonnatakusuma commited on
Commit
11d063e
β€’
1 Parent(s): b8d7645

sophisticated

Browse files
Files changed (2) hide show
  1. MinuteBot.py β†’ MinuteBotNA.py +14 -9
  2. app.py +9 -14
MinuteBot.py β†’ MinuteBotNA.py RENAMED
@@ -4,27 +4,32 @@ from tempfile import NamedTemporaryFile
4
  import ffmpeg
5
 
6
 
7
- st.title("MinuteBot App")
8
 
9
  # upload audio file with streamlit
10
- audio_file = st.file_uploader("Unggah Meeting Audio", type=["mp3", "wav"])
11
 
12
- # model = whisper.load_model("base") # loading the base model
13
- st.text("MinuteBot Model telah dimuat:")
14
 
15
  def load_whisper_model():
16
 
17
  return model
18
 
 
 
 
19
 
20
- if st.sidebar.button("Transkripsikan Audio"):
21
  if audio_file is not None:
22
- with NamedTemporaryFile() as temp:
23
  temp.write(audio_file.getvalue())
24
  temp.seek(0)
25
- model = whisper.load_model("large")
26
- result = model.transcribe(temp.name)
 
 
27
  st.write(result["text"])
 
28
 
29
- st.sidebar.header("Putar Berkas Audio")
30
  st.sidebar.audio(audio_file)
 
4
  import ffmpeg
5
 
6
 
7
+ st.title("Whisper App")
8
 
9
  # upload audio file with streamlit
10
+ audio_file = st.file_uploader("Upload Meeting Audio", type=["m4a", "mp3", "wav"])
11
 
12
+ st.text("Whisper Model Loaded")
 
13
 
14
  def load_whisper_model():
15
 
16
  return model
17
 
18
+ def convert_m4a_to_mp3(input_path, output_path):
19
+ audio = AudioSegment.from_file(input_path, format="m4a")
20
+ audio.export(output_path, format="mp3")
21
 
22
+ if st.sidebar.button("Transcribe Audio"):
23
  if audio_file is not None:
24
+ with NamedTemporaryFile(suffix="mp3") as temp:
25
  temp.write(audio_file.getvalue())
26
  temp.seek(0)
27
+ model = whisper.load_model("base")
28
+ temp_mp3_path = temp.name
29
+ convert_m4a_to_mp3(audio_file, temp_mp3_path)
30
+ result = model.transcribe(temp_mp3_path)
31
  st.write(result["text"])
32
+
33
 
34
+ st.sidebar.header("Play Original Audio File")
35
  st.sidebar.audio(audio_file)
app.py CHANGED
@@ -4,32 +4,27 @@ from tempfile import NamedTemporaryFile
4
  import ffmpeg
5
 
6
 
7
- st.title("Whisper App")
8
 
9
  # upload audio file with streamlit
10
- audio_file = st.file_uploader("Upload Meeting Audio", type=["m4a", "mp3", "wav"])
11
 
12
- st.text("Whisper Model Loaded")
 
13
 
14
  def load_whisper_model():
15
 
16
  return model
17
 
18
- def convert_m4a_to_mp3(input_path, output_path):
19
- audio = AudioSegment.from_file(input_path, format="m4a")
20
- audio.export(output_path, format="mp3")
21
 
22
- if st.sidebar.button("Transcribe Audio"):
23
  if audio_file is not None:
24
- with NamedTemporaryFile(suffix="mp3") as temp:
25
  temp.write(audio_file.getvalue())
26
  temp.seek(0)
27
- model = whisper.load_model("base")
28
- temp_mp3_path = temp.name
29
- convert_m4a_to_mp3(audio_file, temp_mp3_path)
30
- result = model.transcribe(temp_mp3_path)
31
  st.write(result["text"])
32
-
33
 
34
- st.sidebar.header("Play Original Audio File")
35
  st.sidebar.audio(audio_file)
 
4
  import ffmpeg
5
 
6
 
7
+ st.title("MinuteBot App")
8
 
9
  # upload audio file with streamlit
10
+ audio_file = st.file_uploader("Unggah Meeting Audio", type=["mp3", "wav", "m4a"])
11
 
12
+ # model = whisper.load_model("base") # loading the base model
13
+ st.text("MinuteBot Model telah dimuat:")
14
 
15
  def load_whisper_model():
16
 
17
  return model
18
 
 
 
 
19
 
20
+ if st.sidebar.button("Transkripsikan Audio"):
21
  if audio_file is not None:
22
+ with NamedTemporaryFile() as temp:
23
  temp.write(audio_file.getvalue())
24
  temp.seek(0)
25
+ model = whisper.load_model("large")
26
+ result = model.transcribe(temp.name)
 
 
27
  st.write(result["text"])
 
28
 
29
+ st.sidebar.header("Putar Berkas Audio")
30
  st.sidebar.audio(audio_file)