Coder Social home page Coder Social logo

mustrapp's Introduction

Mustrapp

A downloadable template for creating multiple Streamlit apps on the same web site.

The template is structured like this:

/home
|
|-- index.py
|
|-- /stlib
    |
    |-- __init__.py
    |
    |-- app1.py
    |
    |-- app2.py

In the home directory the index.py is where it all starts. So, to run the multiple app you do this:

streamlit run index.py

This will run a Streamlit app with a drop down menu in the sidebar which will contain the list of apps that can be run (in this skeleton template, app1 and app2).

index.py does not need to be changed except to change the the variable message if you wish to.

Apps are stored in the stlib folder and have to adopt a simple structure. They should look like this:

description = "Example app 1"

# Your app goes in the function run()
def run():
        
    import streamlit as st

    st.header("Example app 1")
    st.write("Insert your own Streamlit code here")

# end of app

# This code allows you to run the app standalone
# as well as part of a library of apps
if __name__ == "__main__":
    run()

Essentially the app is contained in the function run() and has an optional description which will be displayed as an entry in the main drop down menu. If no description is given, the menu entry will be the name of the module.

That's about it.

If you use Git you can clone this app, if not download the zip file from the code page.

See the LICENCE for details of use.


If you find this content useful, please consider this...

Buy Me a Coffee at ko-fi.com

mustrapp's People

Contributors

alanjones2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.