Spaces:
Sleeping
Sleeping
jonnatakusuma
commited on
Commit
•
aadb24e
1
Parent(s):
da1cda6
v2
Browse files
app.py
CHANGED
@@ -22,43 +22,10 @@ if st.sidebar.button("Transkripsikan Audio"):
|
|
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')
|
|
|
22 |
with NamedTemporaryFile() as temp:
|
23 |
temp.write(audio_file.getvalue())
|
24 |
temp.seek(0)
|
25 |
+
model = whisper.load_model("large-v2")
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|