Health Universe
  • Core Concepts
    • Overview of Health Universe
    • How Health Universe Works
  • Building Apps in Health Universe
    • Getting started with Health Universe
      • Create a Health Universe Account
      • Create a Github Account
      • Link your Github Account to your Health Universe Account
    • Creating a Workspace
    • Collaborators
    • Developing your Health Universe App
      • Streamlit vs FastAPI
      • Working in Streamlit
        • Typical Project Setup
        • Your First Health Universe App
        • Streamlit Best Practices
      • Working in FastAPI
        • Typical Project Setup
        • Your First Health Universe App
        • Navigator FastAPI best practices
    • Deploying your app to Health Universe
      • Deploying to Health Universe
      • Secret Management
      • Connecting to an LLM
      • Connecting to an external data source
  • Testing your app
  • Re-deploying your app
  • Document your app
  • Deleting your App on Health Universe
  • Additional resources
    • Data Formats, Standards & Privacy
    • External Tools and Libraries
Powered by GitBook
On this page
  • Step 1: Create a GitHub Repository
  • Step 2: Clone Your Repository
  • Step 3: Set Up a Virtual Environment
  • Step 4: Install Streamlit
  • Step 5: Edit App.py
  • Step 6: Run the Streamlit App
  • Step 7: Run pip freeze
  • Step 8: Commit Your Code and Push to GitHub
  • Step 9: Deploy Your App on Health Universe

Was this helpful?

  1. Building Apps in Health Universe
  2. Developing your Health Universe App
  3. Working in Streamlit

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

Run this in your terminal:

git clone https://github.com/<your_account>/<your_repo_name>.git

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:

      .env\Scripts\activate
    • 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.

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.")

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 7: 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 8: Commit Your Code and Push to GitHub

Step 9: Deploy Your App on Health Universe

PreviousWorking in StreamlitNextYour First Health Universe App

Last updated 1 month ago

Was this helpful?

We recommend .

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

this page to get up to speed quickly with Streamlit
find advanced components here