Skip to content

LouisMlr/ae_detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adverse Effect Detection

End-to-end deployment of a Streamlit application to detect adverse effects from free text using OpenAI GPT-3 model.

My Image

Launch the App locally

  1. Navigate into the project directory

    $ cd ae_detection
  2. Create a new virtual environment

    $ python -m venv venv
    $ . venv/bin/activate
  3. Install the requirements

    $ pip install -r api/requirements.txt streamlit/requirements.txt
  4. Add your [OpenAI API key] to the .env file

  5. Run the FastAPI service

    $ uvicorn main:app --reload

FastAPI service is running at http://127.0.0.1:8000

  1. Run the Streamlit App

    $ streamlit run app.py

Streamlit App is running at http://127.0.0.1:8501

Launch the App locally using Docker

  1. Launch the services using docker-compose

    $ docker-compose build
    $ docker-compose up

Launch the App remotely using docker-compose

  1. Create an EC2 instance (Amazon Linux AMI)

  2. In the security group, allow inbound traffic on port 8000 and 8501.

  3. Connect to the instance

  4. Install docker and docker-compose (1.31.1)

    $ sudo yum update -y
    $ sudo amazon-linux-extras install docker
    $ sudo service docker start
    $ sudo systemctl enable docker
    $ sudo usermod -a -G docker ec2-user
    
    $ sudo curl -L https://github.com/docker/compose/releases/download/1.31.1/docker-compose-`uname -s`-`uname -m` | sudo tee /usr/local/bin/docker-compose > /dev/null
    $ sudo chmod +x /usr/local/bin/docker-compose
    $ ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

    4.2 Install docker and docker-compose using Ubuntu AMI

    $ sudo apt-get update
    $ sudo apt-get install docker.io
    $ sudo systemctl start docker
    $ sudo docker run hello-world
    $ sudo apt-get install docker-compose
  5. (Optional) Start a new tmux session

    $ sudo yum install tmux
    $ tmux new -s StreamlitSession

To detach from the TMUX session, use: Ctrl+B and then D

To reattach to the same session, use:

$ tmux attach -t StreamlitSession

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published