Make it possible to run the playground directly
It can now be run with: python -m streamlit run riffusion/streamlit/playground.py python riffusion/streamlit/playground.py python -m riffusion.streamlit.playground Which adds a ton of flexibility.
This commit is contained in:
parent
a0f12d80e2
commit
754c9f8f64
|
@ -124,7 +124,7 @@ Riffusion contains a [streamlit](https://streamlit.io/) app for interactive use
|
||||||
|
|
||||||
Run with:
|
Run with:
|
||||||
```
|
```
|
||||||
python -m streamlit run riffusion/streamlit/playground.py --browser.serverAddress 127.0.0.1 --browser.serverPort 8501
|
python -m riffusion.streamlit.playground
|
||||||
```
|
```
|
||||||
|
|
||||||
And access at http://127.0.0.1:8501/
|
And access at http://127.0.0.1:8501/
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
|
import streamlit.web.cli as stcli
|
||||||
|
from streamlit import runtime
|
||||||
|
|
||||||
PAGES = {
|
PAGES = {
|
||||||
"🎛️ Home": "tasks.home",
|
"🎛️ Home": "tasks.home",
|
||||||
|
@ -12,7 +16,7 @@ PAGES = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def render() -> None:
|
||||||
st.set_page_config(
|
st.set_page_config(
|
||||||
page_title="Riffusion Playground",
|
page_title="Riffusion Playground",
|
||||||
page_icon="🎸",
|
page_icon="🎸",
|
||||||
|
@ -26,4 +30,8 @@ def main() -> None:
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
if runtime.exists():
|
||||||
|
render()
|
||||||
|
else:
|
||||||
|
sys.argv = ["streamlit", "run"] + sys.argv
|
||||||
|
sys.exit(stcli.main())
|
||||||
|
|
Loading…
Reference in New Issue