RustX/whisper_app
0
1from main import *2 3if __name__ == '__main__':4 config()5 6 if st.session_state['page_index'] == -1:7 # Specify token page (mandatory to use the diarization option)8 st.warning('You must specify a token to use the diarization model. Otherwise, the app will be launched without this model. You can learn how to create your token here: https://huggingface.co/pyannote/speaker-diarization / 분할 모델을 사용하려면 토큰을 지정해야 합니다. 그렇지 않으면 이 모델 없이 앱이 실행됩니다. 여기에서 토큰을 만드는 방법을 배울 수 있습니다: https://huggingface.co/pyannote/speaker-diarization')9 text_input = st.text_input("Enter your Hugging Face token: / Hugging Face 토큰을 입력하세요:", placeholder="ACCESS_TOKEN_GOES_HERE", type="password")10 11 # Confirm or continue without the option12 col1, col2 = st.columns(2)13 14 # Save changes button15 with col1:16 confirm_btn = st.button("I have changed my token / 토큰을 변경했습니다", on_click=confirm_token_change, args=(text_input, 0), disabled=st.session_state["disable"])17 # if text is changed, button is clickable18 if text_input != "ACCESS_TOKEN_GOES_HERE":19 st.session_state["disable"] = False20 21 # Continue without a token (there will be no diarization option)22 with col2:23 dont_mind_btn = st.button("Continue without this option / 이 옵션 없이 계속하십시오", on_click=update_session_state, args=("page_index", 0))24 25 if st.session_state['page_index'] == 0:26 # Home page27 choice = st.radio("Features / 특징", ["By a video URL / 비디오 URL로", "By uploading a file / 파일을 업로드하여"]) 28 29 stt_tokenizer, stt_model, summarizer, dia_pipeline = load_models()30 31 if choice == "By a video URL / 비디오 URL로":32 transcript_from_url(stt_tokenizer, stt_model, summarizer, dia_pipeline)33 34 elif choice == "By uploading a file / 파일을 업로드하여":35 transcript_from_file(stt_tokenizer, stt_model, summarizer, dia_pipeline)36 37 elif st.session_state['page_index'] == 1:38 # Display Results page39 display_results()40 41 elif st.session_state['page_index'] == 2:42 # Rename speakers page43 rename_speakers_window()