Skip to content

Instantly share code, notes, and snippets.

Jon Peck peckjon

View GitHub Profile
@peckjon
peckjon / input.py
Created Aug 9, 2018
Extract Structured Data From Web Sites Using Analyze URL
View input.py
import Algorithmia
input = "//blog.algorithmia.com/predictive-algorithms-track-real-time-health-trends/"
client = Algorithmia.client('YOUR API KEY')
algo = client.algo('web/AnalyzeURL/0.2.14')
print algo.pipe(input)
@peckjon
peckjon / input.json
Created Aug 9, 2018
Introduction to Twitter Topic and Sentiment Analysis
View input.json
import Algorithmia
input = {
"query": "seattle seahawks",
"numTweets": "1000",
"auth": {
"app_key": "YOUR_TWITTER_APP_KEY",
"app_secret": "YOUR_TWITTER_APP_SECRET",
"oauth_token": "YOUR_TWITTER_OAUTH_TOKEN",
"oauth_token_secret": "YOUR_TWITTER_OAUTH_TOKEN_SECRET"
@peckjon
peckjon / input.json
Created Aug 9, 2018
Video Metadata Extraction
View input.json
input = {
"input_file":"data://media/videos/lounge_demo.mp4",
"output_file":"data://.algo/temp/detected_objects.json",
"algorithm":"algo://LgoBE/CarMakeandModelRecognition/0.3.4",
"advanced_input":{"$SINGLE_INPUT"}
}
result = client.algo('media/VideoMetadataExtraction?timeout=3000').pipe(input).result
@peckjon
peckjon / content-aware-resize.htm
Created Aug 9, 2018
Smart Autogeneration of Thumbnails Banners, and Socials with Content Aware Resize
View content-aware-resize.htm
<html>
<head>
<script src="https://algorithmia.com/v1/clients/js/algorithmia-0.2.0.js" type="text/javascript"></script>
<script src="content-aware-resize.js" type="text/javascript"></script>
</head>
<body>
<h3>Image:</h3>
<input type="text" size="80" id="img_url" value="https://upload.wikimedia.org/wikipedia/commons/f/f7/Hickory_Golfer.jpg" />
<h3>Automatically resize:</h3>
<input type="submit" value="Thumbnail 150x150" onclick="resize(150,150,'thumb')" /> <a download="thumb.png" id="thumb"></a><br/>
@peckjon
peckjon / setup.py
Created Aug 9, 2018
Quickly Building a Face Recognizer
View setup.py
import Algorithmia
api_key = "YOUR_API_KEY"
client = Algorithmia.client(api_key)
@peckjon
peckjon / getdataset.py
Created Aug 1, 2018
Train a Machine to Turn Documents into Keywords, via Document Classification
View getdataset.py
import Algorithmia
remote_url = 'data://.my/collection/training_data.json'
local_dataset = '/path/to/my/training_dataset.json'
client = Algorithmia.client('YOUR_API_KEY_HERE')
client.file(remote_url).putFile(local_dataset)
@peckjon
peckjon / translate.py
Created Jul 31, 2018
pre-translation in NLP
View translate.py
import Algorithmia
client = Algorithmia.client("your_api_key")
algo_input = {
"action": "translate",
"text": "Me gustan los aguacates"
}
translated_text = client.algo("translation/GoogleTranslate/0.1.1").pipe(algo_input).result["translation"]
You can’t perform that action at this time.