superduper-io / superduper

Superduper: Integrate AI models and machine learning workflows with your database to implement custom AI applications, without moving your data. Including streaming inference, scalable model hosting, training and vector search.
https://superduper.io
Apache License 2.0
4.65k stars 448 forks source link

[STREAMLIT] Demo interface for applications #2405

Open blythed opened 3 weeks ago

blythed commented 3 weeks ago

Users should be able to serve multiple demos for a range of applications in their deployment/ db. These demos should not need to be prespecified at a set path, but should be "installable" in some sense.

Here is an example where we can toggle between multiple views in a single interface:

import streamlit as st

# Function for the first page
def page_one():
    st.title("Page One")
    st.write("Welcome to Page One!")
    st.write("Here is some content specific to the first page.")

# Function for the second page
def page_two():
    st.title("Page Two")
    st.write("Welcome to Page Two!")
    st.write("Here is some content specific to the second page.")

# Function for the third page
def page_three():
    st.title("Page Three")
    st.write("Welcome to Page Three!")
    st.write("Here is some content specific to the third page.")

# Main app
def main():
    st.sidebar.title("Navigation")
    page = st.sidebar.selectbox("Choose a page:", ["Page One", "Page Two", "Page Three"])

    # Display the selected page
    if page == "Page One":
        page_one()
    elif page == "Page Two":
        page_two()
    elif page == "Page Three":
        page_three()

if __name__ == "__main__":
    main()

In our implementation, the pages will come from the saved streamlit components/ applications. The functions will be saved as references and/ or artifacts in some way. This will mean that the main function needs to take db as a parameter.