This file contains hidden or 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 requests | |
endpoint = "http://gateway-a.watsonplatform.net/calls/url/URLGetRankedKeywords" | |
parameters = { | |
'apikey': API_KEY, | |
'outputMode': 'json', | |
'url': 'https://blog.vellumatlanta.com/2016/05/04/apple-stole-my-music-no-seriously/' | |
} | |
r = requests.get(endpoint, params=parameters) |
This file contains hidden or 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 requests | |
endpoint = "http://gateway-a.watsonplatform.net/calls/url/URLGetText" | |
parameters = { | |
'apikey': API_KEY, | |
'outputMode': 'json', | |
'url': 'http://techcrunch.com/' | |
} | |
r = requests.get(endpoint, params=parameters) |
This file contains hidden or 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 requests | |
endpoint = "http://gateway-a.watsonplatform.net/calls/url/URLGetRankedNamedEntities" | |
parameters = { | |
'apikey': API_KEY, | |
'outputMode': 'json', | |
'url': 'https://www.reddit.com/' | |
} | |
r = requests.get(endpoint, params=parameters) |
This file contains hidden or 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 requests | |
entities_endpoint = "http://gateway-a.watsonplatform.net/calls/text/TextGetRankedNamedEntities" | |
def get_entities(text): | |
data = { | |
'apikey': API_KEY, | |
'outputMode': 'json', | |
'text': text | |
} | |
headers = {'content-type': 'application/x-www-form-urlencoded'} |
This file contains hidden or 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
// Sample code for clarifai-nodejs. From https://github.com/Clarifai/clarifai-nodejs/blob/master/clarifai_sample.js | |
var Clarifai = require('./clarifai_node.js'); | |
Clarifai.initAPI(process.env.CLARIFAI_APP_ID, process.env.CLARIFAI_APP_SECRET); | |
// Setting a throttle handler lets you know when the service is unavailable because of throttling. It will let | |
// you know when the service is available again. Note that setting the throttle handler causes a timeout handler to | |
// be set that will prevent your process from existing normally until the timeout expires. If you want to exit fast | |
// on being throttled, don't set a handler and look for error results instead. |
This file contains hidden or 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
""" | |
Tagging a few public images from the web using the Clarifai API and the | |
clarifai-python client. | |
""" | |
from clarifai.client import ClarifaiApi | |
pictures = ['http://i.imgur.com/jJWlcnR.jpg', 'http://i.imgur.com/BflW5HQ.jpg'] |
This file contains hidden or 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
""" | |
Tagging a few local images using the Clarifai API and the clarifai-python | |
client. | |
""" | |
from os.path import expanduser | |
from clarifai.client import ClarifaiApi | |
directory = expanduser('~/pictures/clarifai/') |
This file contains hidden or 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
hey matt | |
import whate |
This file contains hidden or 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
// In the main.js (main process) | |
ipcMain.on('hello from the webpage!', function(event, arg){ | |
console.log('recieved!'); | |
}); |
This file contains hidden or 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
//In index.html (renderer process) | |
ipcRenderer.send('hello from the webpage!', 'my arg'); |