This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
# instantiate local comprehend client | |
comprehend_client = boto3.client('comprehend') | |
text = "A classic love heart emoji, used for expressions of love. Displayed in various shades of red on most platforms. A similar emoji exists for the heart suit in a deck of playing cards. On Snapchat, this emoji displays next to a friend when you have been #1 BFs with each other for two consecutive weeks." | |
# Invoke detect_key_phrases endopint and get response | |
comprehend_response = comprehend_client.detect_key_phrases(Text=text, LanguageCode='en') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en" prefix="op: http://media.facebook.com/op#"> | |
<head> | |
<meta charset="utf-8"> | |
<!-- URL of the web version of this article --> | |
<!-- TODO: Change the domain to match the domain of your website --> | |
<link rel="canonical" href="http://example.com/article.html"> | |
<meta property="op:markup_version" content="v1.0"> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# falcon_gateway.py | |
import falcon | |
import json | |
from data_handler import invoke_predict | |
# Falcon follows the REST architectural style, meaning (among | |
# other things) that you think in terms of resources and state | |
# transitions, which map to HTTP verbs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from authorizenet import apicontractsv1 | |
from authorizenet.apicontrollers import* | |
from decimal import* | |
import credentials # importing our credentials from credentials.py | |
# Authentication steps using Authorize.Net API credentials | |
merchantAuth = apicontractsv1.merchantAuthenticationType() | |
merchantAuth.name = credentials.api_login_name | |
merchantAuth.transactionKey = credentials.transaction_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1) py27 | |
(2) py35 | |
Please select one of the above environment language (e.g. py27): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1) data-analytics : has libraries such as xgboost, lightgbm, sklearn etc. | |
(2) mxnet : has libraries for mxnet(v1.1.0) along with sklearn, opencv etc. | |
(3) caffe2 : has libraries for caffe2(v0.8.0) along with sklearn, opencv etc. | |
(4) keras-tensorflow : has libraries for keras(v2.1.6) and tensorflow(v1.9.0) along with sklearn, opencv etc. | |
(5) kaggle : has the environment provided by kaggle | |
(6) pytorch : has libraries for pytorch(v0.4.0) along with sklearn, opencv etc. | |
(7) python-base : has base python image with no libraries installed | |
(8) r-base : has base R image with no libraries installed. Use this environment for rstudio workspace | |
Please select one of the above environments (e.g. 1 or data-analytics): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1) gpu | |
(2) cpu | |
Please select one of the above environment type (e.g. 1 or gpu): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ `uname` == 'Linux' ]]; then | |
echo 'Removing old Torch files from your Linux...' | |
# Removing folders | |
sudo rm -rf /usr/local/lib/{luarocks/,lua/,torch/,torchrocks/} | |
sudo rm -rf /usr/local/share/{torch,cmake/torch/,lua} | |
sudo rm -rf /usr/local/etc/{luarocks/,torchrocks/} | |
sudo rm -rf /usr/local/include/{torch,TH,THC,lauxlib.h,lua.h,lua.hpp,luaT.h,luaconf.h,luajit.h,lualib.h,qtlua} | |
sudo rm -rf ~/.luarocks | |
sudo rm -rf ~/.cache/luarocks* | |
# Removing files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# falcon.API instances are callable WSGI apps. Never change this. | |
app = falcon.API() | |
# Resources are represented by long-lived class instances. Each Python class becomes a different "URL directory" | |
info = InfoResource() | |
predicts = PredictsResource() | |
# things will handle all requests to the '/info' or '/predicts' URL path | |
app.add_route('/info', info) | |
app.add_route('/predicts', predicts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PredictsResource(object): | |
def on_get(self, req, resp): | |
"""Handles GET requests""" | |
resp.status = falcon.HTTP_200 # This is the default status | |
resp.body = ('\nThis is the PREDICT endpoint. \n' | |
'Both requests and responses are served in JSON. \n' | |
'\n' | |
'INPUT: Flower Lengths (in cm) \n' | |
' "sepal_length":[num] \n' | |
' "sepal_width": [num] \n' |
NewerOlder