File size: 2,358 Bytes
d99f4b8
5f30f3a
d99f4b8
 
5f30f3a
d99f4b8
 
 
 
5f30f3a
d99f4b8
5f30f3a
 
d99f4b8
5f30f3a
d99f4b8
 
 
 
5f30f3a
d99f4b8
5f30f3a
d99f4b8
5f30f3a
d99f4b8
 
 
5f30f3a
d99f4b8
5f30f3a
d99f4b8
 
5f30f3a
d99f4b8
 
5f30f3a
d99f4b8
 
 
5f30f3a
d99f4b8
 
 
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
from main import *

if __name__ == '__main__':
    config()

    if st.session_state['page_index'] == -1:
        # Specify token page (mandatory to use the diarization option)
        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')
        text_input = st.text_input("Enter your Hugging Face token: / Hugging Face 토큰을 μž…λ ₯ν•˜μ„Έμš”:", placeholder="ACCESS_TOKEN_GOES_HERE", type="password")

        # Confirm or continue without the option
        col1, col2 = st.columns(2)

        # Save changes button
        with col1:
            confirm_btn = st.button("I have changed my token / 토큰을 λ³€κ²½ν–ˆμŠ΅λ‹ˆλ‹€", on_click=confirm_token_change, args=(text_input, 0), disabled=st.session_state["disable"])
            # if text is changed, button is clickable
            if text_input != "ACCESS_TOKEN_GOES_HERE":
                st.session_state["disable"] = False

        # Continue without a token (there will be no diarization option)
        with col2:
            dont_mind_btn = st.button("Continue without this option / 이 μ˜΅μ…˜ 없이 κ³„μ†ν•˜μ‹­μ‹œμ˜€", on_click=update_session_state, args=("page_index", 0))

    if st.session_state['page_index'] == 0:
        # Home page
        choice = st.radio("Features / νŠΉμ§•", ["By a video URL / λΉ„λ””μ˜€ URL둜", "By uploading a file / νŒŒμΌμ„ μ—…λ‘œλ“œν•˜μ—¬"]) 

        stt_tokenizer, stt_model, summarizer, dia_pipeline = load_models()

        if choice == "By a video URL / λΉ„λ””μ˜€ URL둜":
            transcript_from_url(stt_tokenizer, stt_model, summarizer, dia_pipeline)

        elif choice == "By uploading a file / νŒŒμΌμ„ μ—…λ‘œλ“œν•˜μ—¬":
            transcript_from_file(stt_tokenizer, stt_model, summarizer, dia_pipeline)

    elif st.session_state['page_index'] == 1:
        # Display Results page
        display_results()

    elif st.session_state['page_index'] == 2:
        # Rename speakers page
        rename_speakers_window()