File size: 1,406 Bytes
a492fff
 
01b8e8e
 
 
 
 
39503cb
01b8e8e
a492fff
01b8e8e
 
 
710a34d
01b8e8e
 
 
 
 
 
710a34d
 
 
01b8e8e
 
 
 
 
 
 
 
 
 
 
 
27e0350
0a35ae0
01b8e8e
 
 
0a35ae0
 
 
 
2a3f625
01b8e8e
 
 
 
 
 
 
 
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
import streamlit as st

st.set_page_config(
    page_title="Neural Search",
    page_icon="πŸ”Ž",
    layout="wide",
    initial_sidebar_state="expanded",
    menu_items={"About": "https://github.com/ugm2/neural-search-demo"},
)

from streamlit_option_menu import option_menu
from interface.config import session_state_variables, pages
from interface.components import component_select_pipeline
from interface.utils import load_audio_model

# Initialization of session state
for key, value in session_state_variables.items():
    if key not in st.session_state:
        st.session_state[key] = value

# Init audio model
st.session_state["audio_model"] = load_audio_model()


def run_demo():

    main_page = st.container()

    st.sidebar.title("🧠 Neural Search πŸ”Ž")

    navigation = st.sidebar.container()

    with navigation:

        selected_page = option_menu(
            menu_title=None,
            options=list(pages.keys()),
            icons=[f[1] for f in pages.values()],
            menu_icon="cast",
            default_index=0,
            styles={
                "container": {"border": "2px solid #818494"},
                "icon": {"font-size": "22px"},
                "nav-link": {"font-size": "20px", "text-align": "left"},
            },
        )
        component_select_pipeline(navigation)

    # Draw the correct page
    pages[selected_page][0](main_page)


run_demo()