GithubHelp home page GithubHelp logo

kobrinartem / chatgpt-streamlit-demo Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 5.0 15 KB

Streamlining AI/ML Implementation with ChatGPT and AWS: A Step-by-Step Guide to Prototyping and Deploying a Chatbot on AWS ECS Fargate

Home Page: https://medium.com/@KobrinArtem/streamlining-ai-ml-implementation-with-chatgpt-and-aws-a-step-by-step-guide-to-prototyping-and-f7b0a1e79f72

License: MIT License

Dockerfile 9.39% Python 90.61%
aws chatgpt cloudformation docker ecs-fargate streamlit

chatgpt-streamlit-demo's Introduction

ChatGPT Operationalisation in AWS: A Chatbot Prototyped with Streamlit and Deployed to AWS ECS Fargate

This project includes a Streamlit-based chatbot operationalized in AWS using AWS ECS Fargate.

Table of Contents

Installation

CloudFormation Stack Deployment

This CloudFormation template creates a Virtual Private Cloud (VPC) with four subnets (two public and two private), an Internet Gateway, and a NAT Gateway. It also creates four route tables (one for each subnet) and routes for each route table to direct traffic to the Internet Gateway or NAT Gateway as appropriate.

The VPC has a CIDR block of 10.0.0.0/16, and the four subnets are created with CIDR blocks of 10.0.1.0/24, 10.0.2.0/24, 10.0.3.0/24, and 10.0.4.0/24. The public subnets are mapped to have public IP addresses on launch, and the private subnets are not.

There are also a few parameters defined at the beginning of the template that allow the user to specify an allowed IP address range for accessing port 80 on the load balancer, the name of an Elastic Container Registry (ECR) repository, and the path to an API key in the SSM Parameter Store.

To deploy the CloudFormation stack for this project, use the ./cf.yaml file. You can do this using the AWS Management Console, the AWS CLI, or the AWS SDKs.

CloudFormation Parameters

Parameter Description Default Value
AllowedIP Comma-separated list of IP addresses that should be allowed to access port 80 on the load balancer 0.0.0.0/0
Repository The name of the ECR repository public.ecr.aws/a9t7y4w6/demo-chatgpt-streamlit:latest
ChatGptApiKeyPath ChatGPT API Key path in SSM Parameter Store /openai/api_key

For example, to deploy the stack using the AWS CLI, you can use the following command with default values:

aws cloudformation create-stack \
  --stack-name chatgpt-streamlit \
  --template-body file://cf.yaml \
  --capabilities CAPABILITY_IAM

For example, to deploy the stack using the AWS CLI, you can use the following command with custom values:

aws cloudformation create-stack --stack-name chatgpt-streamlit \
  --template-body file://cf.yaml \
  --parameters ParameterKey=AllowedIP,ParameterValue=1.2.3.4/32 ParameterKey=Repository,ParameterValue=public.ecr.aws/a9t7y4w6/demo-chatgpt-streamlit:latest ParameterKey=ChatGptApiKeyPath,ParameterValue=/openai/api_key

This will create a new stack called chatgpt-streamlit using the cf.yaml template file and the CAPABILITY_IAM capability.

Docker Image Build

To build the Docker image for this project, use the Dockerfile in the ./app directory. You can do this using the docker build command.

For example, to build the image using the Dockerfile in the current directory, you can use the following command:

docker build -t chatgpt-streamlit .

This will build the image and tag it with the name chatgpt-streamlit.

Docker Container Run

docker run -p 8501:8501 -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
  -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
  -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
  -e AWS_DEFAULT_REGION="us-east-1" \
  public.ecr.aws/a9t7y4w6/demo-chatgpt-streamlit:latest

Usage

The Streamlit application is deployed in an AWS ECS cluster and is available through a web browser using the URL of the load balancer. To access the app, simply navigate to the URL in a web browser.

Support

If you have any questions or encounter any issues while using the project, please don't hesitate to reach out. You can find contact information in the CONTRIBUTING section below.

Contributing

We welcome contributions to this project! If you would like to contribute, please follow these guidelines:

  • Create an issue to discuss the change you would like to make.
  • Once the change has been discussed and approved, you can submit a pull request.
  • All pull requests should include tests to ensure that the code is working as intended.
  • Once the pull request has been reviewed and accepted, it will be merged into the main branch.

Thank you for your interest in contributing to the project!

chatgpt-streamlit-demo's People

Contributors

kobrinartem avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.