Spaces:
Sleeping
Sleeping
jonnatakusuma
commited on
Commit
•
da1cda6
1
Parent(s):
a477f7d
revert
Browse files
app.py
CHANGED
@@ -1,64 +1,64 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
|
6 |
|
7 |
-
|
8 |
|
9 |
-
#
|
10 |
-
|
11 |
|
12 |
-
#
|
13 |
-
|
14 |
|
15 |
-
|
16 |
|
17 |
-
|
18 |
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
import streamlit as st
|
33 |
-
from tempfile import NamedTemporaryFile
|
34 |
-
import ffmpeg
|
35 |
-
from transformers import Wav2Vec2ForCTC, Wav2Vec2Tokenizer
|
36 |
-
import librosa
|
37 |
|
38 |
-
# HF_TOKEN = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
|
39 |
|
40 |
-
st.title("TemplarX-Medium-Indonesian Transcription App")
|
41 |
-
st.text("Model Whisper (TemplarX-medium-Indonesian) telah dimuat:")
|
42 |
|
43 |
-
def load_whisper_model():
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
audio_file = st.file_uploader("Unggah Meeting Audio", type=["mp3", "wav", "m4a"])
|
50 |
|
51 |
-
if st.sidebar.button("Transkripsikan Audio"):
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
|
63 |
-
st.sidebar.header("Putar Berkas Audio")
|
64 |
-
st.sidebar.audio(audio_file, format='audio/wav')
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import whisper
|
3 |
+
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", "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)
|
31 |
|
32 |
+
# import streamlit as st
|
33 |
+
# from tempfile import NamedTemporaryFile
|
34 |
+
# import ffmpeg
|
35 |
+
# from transformers import Wav2Vec2ForCTC, Wav2Vec2Tokenizer
|
36 |
+
# import librosa
|
37 |
|
38 |
+
# # HF_TOKEN = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
|
39 |
|
40 |
+
# st.title("TemplarX-Medium-Indonesian Transcription App")
|
41 |
+
# st.text("Model Whisper (TemplarX-medium-Indonesian) telah dimuat:")
|
42 |
|
43 |
+
# def load_whisper_model():
|
44 |
+
# model_name = "jonnatakusuma/TemplarX-medium-Indonesian"
|
45 |
+
# tokenizer = Wav2Vec2Tokenizer.from_pretrained(model_name)
|
46 |
+
# model = Wav2Vec2ForCTC.from_pretrained(model_name, use_auth_token=True)
|
47 |
+
# return tokenizer, model
|
48 |
|
49 |
+
# audio_file = st.file_uploader("Unggah Meeting Audio", type=["mp3", "wav", "m4a"])
|
50 |
|
51 |
+
# if st.sidebar.button("Transkripsikan Audio"):
|
52 |
+
# if audio_file is not None:
|
53 |
+
# with NamedTemporaryFile() as temp:
|
54 |
+
# temp.write(audio_file.read())
|
55 |
+
# temp.seek(0)
|
56 |
+
# tokenizer, model = load_whisper_model()
|
57 |
+
# # Read the audio file and transcribe using the fine-tuned model
|
58 |
+
# audio_path = temp.name
|
59 |
+
# audio_input, _ = librosa.load(audio_path, sr=16000)
|
60 |
+
# transcription = model.stt(text)
|
61 |
+
# st.write(transcription)
|
62 |
|
63 |
+
# st.sidebar.header("Putar Berkas Audio")
|
64 |
+
# st.sidebar.audio(audio_file, format='audio/wav')
|