Este tutorial fornecerá uma introdução sobre como usar o AWS Chalice e instruções sobre como construir seu primeiro aplicativo serverless usando Chalice.
Pré-requisitos
- AWS ...
| # HELP analysis_run_info Information about analysis run. | |
| # TYPE analysis_run_info gauge | |
| # HELP analysis_run_metric_phase Information on the duration of a specific metric in the Analysis Run | |
| # TYPE analysis_run_metric_phase gauge | |
| # HELP analysis_run_metric_type Information on the type of a specific metric in the Analysis Runs | |
| # TYPE analysis_run_metric_type gauge | |
| # HELP analysis_run_phase Information on the state of the Analysis Run |
| var express = require('express'); // importar o express | |
| var bodyParser = require('body-parser'); // importar o body-parser | |
| var path = require('path'); // importar lib path (nativa do node.js) | |
| var firebase = require("firebase"); | |
| const crypto = require("crypto"); | |
| var firebaseConfig = { | |
| }; |
| import com.amazonaws.ClientConfiguration; | |
| import com.amazonaws.auth.AWSCredentialsProvider; | |
| import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; | |
| import com.amazonaws.retry.PredefinedRetryPolicies; | |
| import com.amazonaws.retry.RetryPolicy; | |
| import com.amazonaws.services.s3.AmazonS3; | |
| import com.amazonaws.services.s3.AmazonS3ClientBuilder; | |
| import org.springframework.beans.factory.annotation.Value; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; |
| import tensorflow as tf | |
| from tensorflow import keras | |
| from tensorflow.keras.preprocessing import image | |
| import numpy as np | |
| class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', | |
| 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot'] | |
| model = tf.keras.models.load_model('saved_model/my_model') |
Exercício Express
Na aula anterior, vimos rapidamente como funciona uma requisição com o método POST no HTTP, usando Express. Neste tutorial, você irá implementar uma requisição do tipo POST e testar usando a ferramenta Postman.
O trecho de código a seguir é uma implementação do método POST no Express.
app.post('/soma', function (req, res) {| version: '3' | |
| services: | |
| nginx: | |
| image: nginx | |
| ports: | |
| - 80:80 | |
| volumes: | |
| - ./nginx.conf:/etc/nginx/nginx.conf | |
| - wordpress:/usr/share/nginx/html |
| var app = angular.module('catsvsdogs', []); | |
| var socket = io.connect({transports:['polling']}); | |
| var bg1 = document.getElementById('background-stats-1'); | |
| var bg2 = document.getElementById('background-stats-2'); | |
| app.controller('statsCtrl', function($scope){ | |
| $scope.aPercent = 50; | |
| $scope.bPercent = 50; |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <p>Conteúdo</p> | |
| </body> |
| import os | |
| import tarfile | |
| import time | |
| import numpy as np | |
| import six.moves.urllib as urllib | |
| import tensorflow as tf | |
| tf.logging.set_verbosity(tf.logging.INFO) |