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
<?php | |
$data = ; | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_POST => true, | |
CURLOPT_URL => "https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classify?version=2015-12-02", | |
CURLOPT_USERPWD => "USERNAME:PASSWORD", | |
CURLOPT_POSTFIELDS => array("images_file" => "@/path/to/your/image.png"), |
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
// 1. Create the conversation | |
String message = "This is the first message"; | |
Conversation conversation = new Conversation().workspaceId("dialog_id"); | |
conversation = service.converse(message, conversation); | |
System.out.println(conversation); | |
// 2. Second message using the previous response | |
message = "This is the second message"; | |
conversation = service.converse(message, conversation); | |
System.out.println(conversation); |
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
// face recognition with a URL | |
var params = { | |
knowledgeGraph: 1 // Include knowledge graph information in the the results. | |
url: 'https://upload.wikimedia.org/wikipedia/commons/0/00/Scarlett_Johansson_-_Captain_America_2_press_conference_%28retouched%29_2.jpg' | |
}; | |
// UNCOMMENT THE CODE BELOW TO SEND AN IMAGE INSTEAD OF A URL | |
// face recognition with an image | |
// var params = { | |
// image: fs.createReadStream('resources/face.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
#!/bin/sh | |
# This script clears the terminal, call the IBM Watson Speech to Text service. | |
USERNAME="<SERVICE_USERNAME>" | |
PASSWORD="<SERVICE_PASSWORD>" | |
SESSION_ID="<SESSION_ID>" # you will get this after running (1) | |
# 1. Create a session: | |
curl -X POST -b cookies.txt -c cookies.txt -u $USERNAME:$PASSWORD -d "{}" "https://stream.watsonplatform.net/speech-to-text/api/v1/sessions" | |
# This returns you a session URL. Note that the client needs to support cookies for sessions to work. |
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
'use strict'; | |
var watson = require('../nodejs-wrapper/lib/index'); | |
var fs = require('fs'); | |
var natural_language_classifier = watson.natural_language_classifier({ | |
url: 'https://gateway.watsonplatform.net/natural-language-classifier/api', | |
username: 'USERNAME', | |
password: 'PASSWORD', | |
version: 'v1' |
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
'use strict'; | |
// replace username and password with speech to text credentials | |
// audio.wav can be found here: https://github.com/watson-developer-cloud/nodejs-wrapper/blob/master/test/resources/audio.wav?raw=true | |
var watson = require('watson-developer-cloud'), | |
fs = require('fs'); | |
var speechToText = watson.speech_to_text({ | |
password: '<username>', | |
username: '<password>', |
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
sudo find / -name ".DS_Store" -depth -exec rm {} \; |
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
var regexp = /^[A-z\u00C0-\u00ff\s'\.,-\/#!$%\^&\*;:{}=\-_`~()]+$/, | |
ascii = ' hello !@#$%^&*())_+=', | |
latin = 'Panamá, ratón, cortés, árbol, azúcar, ángel', | |
chinese = ' 你 好 '; | |
console.log(regexp.test(ascii)); // true | |
console.log(regexp.test(latin)); // true | |
console.log(regexp.test(chinese)); // false |
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
Show hidden characters
{ | |
"globals": { | |
"jasmine": false, | |
"spyOn": false, | |
"it": false, | |
"console": false, | |
"describe": true, | |
"expect": false, | |
"beforeEach": false, | |
"before": false, |
NewerOlder