- Hands-On Artificial Intelligence on Amazon Web Services
- Subhashini Tripuraneni Charles Song
- 602字
- 2021-06-24 12:48:47
Creating the base project structure
Next, let's create the hands-on project structure. Follow these steps to create the architecture and technology stack:
- In Terminal, we will create the root project directory and enter it with the following commands:
$ mkdir ObjectDetector
$ cd ObjectDetector
- We will create placeholders for the web frontend by creating a directory named Website. Within this directory, we will have two files, index.html and scripts.js, as follows:
$ mkdir Website
$ touch Website/index.html
$ touch Website/scripts.js
- We will create a Python 3 virtual environment with pipenv in the project's root directory. Our Python portion of the project needs two packages, boto3 and chalice. We can install them with the following commands:
$ pipenv --three
$ pipenv install boto3
$ pipenv install chalice
- Remember that the Python packages that were installed via pipenv are only available if we activate the virtual environment. One way to do this is with the following command:
$ pipenv shell
- Next, while still in the virtual environment, we will create the orchestration layer as an AWS Chalice project named Capabilities with the following commands:
$ chalice new-project Capabilities
This command will create a Chalice project structure within the ObjectDetector directory. The Chalice project structure should look similar to the following:
├── ObjectDetector/
├── Capabilities/
├── .chalice/
├── config.json
├── app.py
├── requirements.txt
...
In this project structure, we have the following:
- The config.json file contains configuration options for deploying our Chalice application to AWS.
- The app.py file is the main Python file where our public orchestration APIs are defined and implemented.
- The requirements.txt file specifies the Python packages that are needed by the application when it is deployed to AWS. These packages are different from the packages we installed using Pipenv. The Pipenv installed packages are the ones we need during development in the local environment; the packages in the requirements.txt file are the ones the application needs to run in the AWS cloud. For example, AWS Chalice is required during the development of the application but it is not needed once the application has been deployed to AWS.
- Now, we need to create a chalicelib Python package within the Chalice project structure in the Capabilities directory. Chalice will automatically include any of the Python files in chalicelib in the deployment package. We will use chalicelib to hold the Python classes that implement our private APIs.
To create the chalicelib package, issue the following commands:
cd Capabilities
mkdir chalicelib
touch chalicelib/__init__.py
cd ..
Note that __init__.py makes chalicelib a proper Python package.
We should have the following project directory structure:
Project Structure
------------
├── ObjectDetector/
├── Capabilities/
├── .chalice/
├── config.json
├── chalicelib/
├── __init__.py
├── app.py
├── requirements.txt
├── Website/
├── index.html
├── script.js
├── Pipfile
├── Pipfile.lock
This is the project structure for the ObjectDetector application. It contains all the layers of the AI application architecture we defined earlier. This project structure is also the base structure for all the hands-on projects in part 2 of this book.
- Instant Raspberry Pi Gaming
- 后稀缺:自動化與未來工作
- 構(gòu)建高質(zhì)量的C#代碼
- 火格局的時空變異及其在電網(wǎng)防火中的應(yīng)用
- 智能傳感器技術(shù)與應(yīng)用
- 中文版Photoshop CS5數(shù)碼照片處理完全自學(xué)一本通
- 數(shù)據(jù)庫原理與應(yīng)用技術(shù)學(xué)習(xí)指導(dǎo)
- 精通Excel VBA
- VMware Performance and Capacity Management(Second Edition)
- Apache Spark Deep Learning Cookbook
- 四向穿梭式自動化密集倉儲系統(tǒng)的設(shè)計與控制
- 數(shù)據(jù)通信與計算機(jī)網(wǎng)絡(luò)
- Learn CloudFormation
- Linux嵌入式系統(tǒng)開發(fā)
- Learning Linux Shell Scripting