Typical Project Setup

Now that you have installed the required software, it's time to create a basic Streamlit project. In this section, we'll guide you through creating a new project, configuring your development tools, and setting up a basic application structure.

Step 1: Create a GitHub Repository

Go to GitHub and create a new public repository. At this time, the repo must be public in order for Health Universe to be able to deploy your project.

Step 2: Clone Your Repository

Step 3: Set Up a Virtual Environment

Setting up a virtual environment for your Health Universe projects is required as it creates the requirements.txt file needed to specify your application's dependencies. To create a virtual environment, follow these steps:

  1. Open a terminal and navigate to your desired project directory.

  2. Create a new virtual environment with the following command:

    python -m venv .env
  3. Activate the virtual environment:

    • Windows:

    • macOS and Linux:

      source .env/bin/activate

Once activated, your terminal should display the environment name, e.g., (venv).

Step 4: Install Streamlit

Streamlit is an open-source app framework that allows you to create and share custom web applications for machine learning and data science. Health Universe uses Streamlit to build and deploy interactive healthcare applications. To install Streamlit, run the following command in your terminal:

pip install streamlit

Wait for the installation to complete. Streamlit is now installed on your system and ready for use in your Health Universe projects.

We recommend this page to get up to speed quickly with Streamlit.

Step 5: Edit App.py

As a starting point, let's create a simple "Hello, World!" application using Streamlit. Open app.py in your text editor or IDE and add the following code:

import streamlit as st

st.title("Welcome to Health Universe!")
st.write("This is a sample application.")

There are many different Streamlit components that make it easy to create rich UI for your health research applications. Learn more about Streamlit and find advanced components here.

Save the app.py file.

Step 6: Run the Streamlit App

To run your "Hello, World!" Streamlit app, open the terminal, navigate to your project directory, and run the following command:

streamlit run app.py

Streamlit will launch your app in your default web browser, displaying the "Hello, World!" message. To stop the app, press Ctrl+C in the terminal.

Step 8: Run pip freeze

From your terminal, run:

pip freeze > requirements.txt

This command will save all your project's dependencies into a requirements.txt file. This file is read by the Health Universe cloud to know what libraries your app will require.

Step 9: Commit Your Code and Push to GitHub

Step 10: Deploy Your App on Health Universe

Last updated