Spaces:
Sleeping
Sleeping
File size: 2,106 Bytes
da1cda6 a105247 da1cda6 a105247 da1cda6 a105247 da1cda6 a105247 da1cda6 a105247 da1cda6 a105247 da1cda6 d73b234 da1cda6 d73b234 da1cda6 d73b234 da1cda6 b872bd7 da1cda6 d73b234 da1cda6 d73b234 da1cda6 d73b234 da1cda6 169b7bd da1cda6 |
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
import streamlit as st
import whisper
from tempfile import NamedTemporaryFile
import ffmpeg
st.title("MinuteBot App")
# upload audio file with streamlit
audio_file = st.file_uploader("Unggah Meeting Audio", type=["mp3", "wav", "m4a"])
# model = whisper.load_model("base") # loading the base model
st.text("MinuteBot Model telah dimuat:")
def load_whisper_model():
return model
if st.sidebar.button("Transkripsikan Audio"):
if audio_file is not None:
with NamedTemporaryFile() as temp:
temp.write(audio_file.getvalue())
temp.seek(0)
model = whisper.load_model("large")
result = model.transcribe(temp.name)
st.write(result["text"])
st.sidebar.header("Putar Berkas Audio")
st.sidebar.audio(audio_file)
# import streamlit as st
# from tempfile import NamedTemporaryFile
# import ffmpeg
# from transformers import Wav2Vec2ForCTC, Wav2Vec2Tokenizer
# import librosa
# # HF_TOKEN = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
# st.title("TemplarX-Medium-Indonesian Transcription App")
# st.text("Model Whisper (TemplarX-medium-Indonesian) telah dimuat:")
# def load_whisper_model():
# model_name = "jonnatakusuma/TemplarX-medium-Indonesian"
# tokenizer = Wav2Vec2Tokenizer.from_pretrained(model_name)
# model = Wav2Vec2ForCTC.from_pretrained(model_name, use_auth_token=True)
# return tokenizer, model
# audio_file = st.file_uploader("Unggah Meeting Audio", type=["mp3", "wav", "m4a"])
# if st.sidebar.button("Transkripsikan Audio"):
# if audio_file is not None:
# with NamedTemporaryFile() as temp:
# temp.write(audio_file.read())
# temp.seek(0)
# tokenizer, model = load_whisper_model()
# # Read the audio file and transcribe using the fine-tuned model
# audio_path = temp.name
# audio_input, _ = librosa.load(audio_path, sr=16000)
# transcription = model.stt(text)
# st.write(transcription)
# st.sidebar.header("Putar Berkas Audio")
# st.sidebar.audio(audio_file, format='audio/wav')
|