Spaces:
Runtime error
Runtime error
File size: 2,092 Bytes
ae202f9 a4f7be2 b1fdcc2 a4f7be2 b1fdcc2 13696ea de58ad9 b1fdcc2 2c9d596 b1fdcc2 2c9d596 ae202f9 2c9d596 de58ad9 b1fdcc2 2935cde 2c3c1a7 b1fdcc2 13696ea de58ad9 b1fdcc2 de58ad9 b1fdcc2 de58ad9 a4f7be2 b1fdcc2 26b2dc0 b1fdcc2 81e9fd6 b1fdcc2 | 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 66 67 68 69 | import streamlit as st
from loguru import logger as log
from streamlit_option_menu import option_menu
from helpers import switch_page
from style import CSS
DEFAULT_PAGE = "Separate"
def header(logo_and_title=True):
if "first_run" not in st.session_state:
st.session_state.first_run = True
for key in [
"selected_value",
"filename",
"executed",
"play_karaoke",
"url",
"random_song",
"last_dir",
"player_restart",
]:
st.session_state[key] = None
st.session_state.video_options = []
st.session_state.tot_delay = 0
if "search_results" not in st.session_state:
st.session_state.search_results = []
if "page" not in st.session_state:
switch_page(DEFAULT_PAGE)
st.set_page_config(
page_title="Psicofonía - Music Separation and Karaoke - Free and Open Source alternative to lalal.ai, splitter.ai or media.io vocal remover.",
page_icon="img/ps.png",
layout="wide",
initial_sidebar_state="collapsed",
)
st.markdown(CSS, unsafe_allow_html=True)
options = ["Separate", "Karaoke"]
page = option_menu(
menu_title=None,
options=options,
# bootrap icons
icons=["play-btn-fill", "file-earmark-music", "info-circle"],
default_index=options.index(st.session_state.get("page", DEFAULT_PAGE)),
orientation="horizontal",
styles={"nav-link": {"padding-left": "1.5rem", "padding-right": "1.5rem"}},
key="",
)
if page != st.session_state.get("page", DEFAULT_PAGE):
log.info(f"Go to {page}")
switch_page(page)
if logo_and_title:
head = st.columns([5, 1, 3, 5])
with head[1]:
st.image("img/ps.png", use_column_width=False, width=80)
with head[2]:
st.markdown(
"<h1>Psicofonia</h1><p><b>Music Source Separation & Karaoke</b></p>",
unsafe_allow_html=True,
)
if __name__ == "__main__":
header()
|