2023-03-26 17:29:14 -06:00
|
|
|
import sys
|
|
|
|
|
2022-12-27 01:25:19 -07:00
|
|
|
import streamlit as st
|
2023-03-26 17:29:14 -06:00
|
|
|
import streamlit.web.cli as stcli
|
|
|
|
from streamlit import runtime
|
2022-12-27 01:25:19 -07:00
|
|
|
|
2023-03-26 16:54:28 -06:00
|
|
|
PAGES = {
|
|
|
|
"🎛️ Home": "tasks.home",
|
|
|
|
"🌊 Text to Audio": "tasks.text_to_audio",
|
|
|
|
"✨ Audio to Audio": "tasks.audio_to_audio",
|
|
|
|
"🎭 Interpolation": "tasks.interpolation",
|
|
|
|
"✂️ Audio Splitter": "tasks.split_audio",
|
|
|
|
"📜 Text to Audio Batch": "tasks.text_to_audio_batch",
|
|
|
|
"📎 Sample Clips": "tasks.sample_clips",
|
|
|
|
"⏈ Spectrogram to Audio": "tasks.image_to_audio",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-03-26 17:29:14 -06:00
|
|
|
def render() -> None:
|
2023-03-26 16:54:28 -06:00
|
|
|
st.set_page_config(
|
|
|
|
page_title="Riffusion Playground",
|
|
|
|
page_icon="🎸",
|
|
|
|
layout="wide",
|
2022-12-27 01:25:19 -07:00
|
|
|
)
|
|
|
|
|
2023-03-26 16:54:28 -06:00
|
|
|
page = st.sidebar.selectbox("Page", list(PAGES.keys()))
|
|
|
|
assert page is not None
|
|
|
|
module = __import__(PAGES[page], fromlist=["render"])
|
|
|
|
module.render()
|
|
|
|
|
2022-12-27 01:25:19 -07:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2023-03-26 17:29:14 -06:00
|
|
|
if runtime.exists():
|
|
|
|
render()
|
|
|
|
else:
|
|
|
|
sys.argv = ["streamlit", "run"] + sys.argv
|
|
|
|
sys.exit(stcli.main())
|