Alchemy API 2

Similar documents
PowerPoint Presentation

Microsoft PowerPoint - TwitterInsight edit.pptx

Bluemix いつでもWebinarシリーズ 第15回 「Bluemix概説(改訂版)」

ii II Web Web HTML CSS PHP MySQL Web Web CSS JavaScript Web SQL Web


websample 1 2 websample index.html

PowerPoint プレゼンテーション

経営論集2011_07_小松先生.indd


情報システム設計論II ユーザインタフェース(1)

情報システム設計論II ユーザインタフェース(1)

Web

World Wide Web =WWW Web ipad Web Web HTML hyper text markup language CSS cascading style sheet Web Web HTML CSS HTML

<td width=99%><input type="file" size="80" name="file"></td> <td width=1% nowrap align=right valign=top> 削除キー : </td> <td width=99%><input type="passw

■サイトを定義する

SmartBrowser_document_build30_update.pptx

立ち読みページ

PowerPoint プレゼンテーション



Taro php.jtdc

untitled

1221 Transitionの指定項目

1

Web データ管理 JavaScript (3) (4 章 ) 2011/12/21( 水 ) 湘南工科大学講義資料 Web データ管理 (2011) 阿倍 1/18

年刊EDP 2003

<4D F736F F D A957A A A8FEE95F18F88979D DEC90AC E646F63>

6 2 1

overflow プロパティの指定は 親ボックスのスタイルに記述します overflow プロパティは position プロパティ (position: static; 以外 ) の指定がされていなと適用されません ボックスの外にはみ出た部分を表示させたくないときに hidden を使用します サ

transform: skewx(x 軸の傾斜角度 ) transform: skewy(y 軸の傾斜角度 ) transform: skew(x 軸の傾斜角度, Y 軸の傾斜角度 ) skewx( ) は X 軸に沿って傾斜します skewy( ) は Y 軸に沿って傾斜します skew( ) は

Web プログラミング 1 HTML+CSS (6) (2 章 ) 2013/5/29( 水 ) 演習室の PC のハードディスクには演習で作成したデータは保管できません 各 PC の ネットワーク接続 ショートカットからメディア情報センターのサーバーにアクセスしてください (Z ドライブとして使用

Web データ管理 HTML+CSS (6) (2 章 ) 2011/11/9( 水 ) 湘南工科大学講義資料 Web データ管理 (2011) 阿倍 1/21

_IMv2.key

6 2 s µ µµµ µµµµ µ µ h µs µ µµµµ µ µ µ s mµµµµµ µµµ µµ µ u m µmµµµµµ µµ µ µ µ µ µ µ µ µ s 1

( )

<!DOCTYPE html> <html> <head> <title>spaceorbitanime</title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="spaceorbitanime.css">

HTML Flash Alt 2

CSS

transform: translatex(x 方向の移動距離 ) transform: translatey(y 方向の移動距離 ) transform: translate(x 方向の移動距離, Y 方向の移動距離 ) transform: translate 関数は 移動する位置ではなく 移動

Windows Macintosh 18 Java Windows 21 Java Macintosh

07_経営論集2010 小松先生.indd

[1] Excel Excel... [3]. CSV RDF. [4] LinkedData. [5] LinkedData 1 RDF. OLAP. OLAP. [6] RDBMS. Excel CSV. CSV JSON RDF. Excel RDF. RDF RDF..

hands_on_4.PDF

m_sotsuron

■新聞記事

1222-B Transform Using Class And Tag (classセレクタと要素型セレクタ(Tag)を使用してスタイルを適用する)


54 5 PHP Web hellow.php 1:<?php 2: echo "Hellow, PHP!Y=n"; 3:?> echo PHP C 2: printf("hellow, PHP!Y=n"); PHP (php) $ php hellow.php Hellow, PHP! 5.1.2

untitled

1つ目は MASK という文字の下に楕円形のマスクイメージで その文字と楕円形の中に複数画像のスライドを表示するので id 属性 slide の div 要素の中に画像を5つ (images/dsc00203l.jpg images/dsc00027l.jpg images/dsc00092l.jp

IPSJ SIG Technical Report Vol.2014-HCI-157 No.26 Vol.2014-GN-91 No.26 Vol.2014-EC-31 No /3/15 1,a) 2 3 Web (SERP) ( ) Web (VP) SERP VP VP SERP

サンプル CSS web ページを開くと同時にピエロの玉乗りが動き出すアニメーションを作ってみましょう AnimeAuto の説明 HTML の記述 (AnimeAuto.html) ピエロの画像に pierrot という id を 玉の画像に ball という id を付けておきます <!DOCT


Homepage HTML+CSS Flash JavaScript Homepage Homepage Homepage Homepage Web HTML Hyper Text Markup Language XHTML XHTML HTML5 CSS Cascading Style Sheet

WordPress Web

FlashAir Tutorial -FlashAir のチュートリアル Bluemix に繋げてみよう 2016 年 6 月 25 日第 1 版第 1 刷発行 著者表紙イラスト編集発行連絡先 谷津じむ余熱 FlashAir Developers

untitled

<!DOCTYPE html> <html> <head> <title>clipanime1</title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="clipanime1.css"> </head> <

.....


画像 images/ SpaceShuttle.png を指定します <!DOCTYPE html> <html> <head> <title>circleanime1</title> <meta charset="utf-8"> <link rel="stylesheet" type="text/


SVG資料第10回目(その2) Ajaxによる同期通信と非同期通信の違い

_勉強会_丸山さつき_v3

(3) 本文を書く 実際にページを開いたときに表示される本文を書いてみましょう から の間に書きます <html > <head > <title > 武のホームページ </title > </head > </html > (4) ページを保存する ここで一度ページを保存してみましょう テキストエ

平和教育の目標と主題(案)

IT/IT IBM IBM 100 IBM IBM DNA IBM IBM IT IT IT IT IT IT IoT Cloud / / IBM IBM IT/IT IT IT IBM 1. XX Important Legal Information/Data Protection 2. App

ohp.mgp

help gem gem gem my help

Lotus Domino XML活用の基礎!

Web±ÜÍ÷¤Î³Ú¤·¤µ¤ò¹â¤á¤ëWeb¥Ú¡¼¥¸²ÄÄ°²½¥·¥¹¥Æ¥à

Webデザイン論

Wiki

Microsoft PowerPoint - Tutorial_2_upd.ppt

Color Change

トリガーをわかり易くする方法

橡点検記録(集約).PDF

ISコースプロジェクト実習 前期(第1回 ガイダンス)

Web 設計入門

2009 Web B012-1

MQTTとアンドロイドで 本格的IoTを体験しよう

XSLT 4-1

~/WWW-local/compIID (WWW IID ) $ mkdir WWW-local $ cd WWW-local $ mkdir compiid 3. Emacs index.html n (a) $ cd ~/WWW/compIID

ホームページ制作 基礎編 (HTML5 CSS3 コーディング )

Oracle HTML DBのテンプレート・カスタマイズ

pdf

VOL.8

untitled

Java


1.`16

-59-

Web プログラミング 1 JavaScript (3) (4 章 ) 2013/7/3( 水 ) 日時 講義内容 4/10 ( 水 ) ガイダンス Web (1 章 ) 4/17 ( 水 ) HTML+CSS (1) (2 章 ) 4/24 ( 水 ) HTML+CSS (2) (2 章 ) 5/

WebOS aplat WebOS WebOS 3 XML Yahoo!Pipes Popfry UNIX grep awk XML GUI WebOS GUI GUI 4 CUI

Microsoft Word - manual.doc

SHOBI_Portal_Manual

(1)2004年度 日本地理

画像全体を左右反転させると 下の画像 ( 黄緑色の外枠に白い桜 ) は backface-visibility: visible; と指定してあるので裏側が表示されます 上の画像 ( 水色の外枠に紅葉 ) は backface-visibility: hidden; と指定してあるので裏側が表示され

Microsoft Word - Documento2

FileList Convert a pdf file!

Transcription:

IBM Bluemix AlchemyAPI 1

Alchemy API 2

Free API Key h"p://www.alchemyapi.com/ 3

目的 チェック ( 例 )To retrieve meta informa7on in images. 名 姓 メールアドレス確認メールアドレス 挑戦すること 4

Free API Key!! 1000! API API! API =! API API 5

API Key 6

7

ちなみに IBM では 人 工知能 (AI) とは 言いません コグニティブ (Cogni.ve 認識識型 人 工知能 ) と 言います ( ) AI 8 AlchemyAPI Watson

Alchemy Vision Alchemy Face Detec7on 結果のフォーマット 各配列要素の中身 9

URL Alchemy Vision Alchemy Face Detect API 10

AlchemyVision h"p://www.alchemyapi.com/products/demo/alchemyvision Top Page >> Products >> Demo >> AlchemyVision Demo 11

Alchemy Vision API URL URL Get http://access.alchemyapi.com/calls/url/urlgetrankedimagekeywords?apikey= API &url= URL &outputmode=json &knowledgegraph=1 12

URLGetRankedImageKeywords API { "status": "OK", "usage": "By accessing AlchemyAPI or ", "url": "h<p://xxx.com/wp- content/uploads/2015/05/aaaa.jpg", "totaltransacjons": 4", この API コールで消費したトランザクションは 4 "imagekeywords": [ 結果は imagekeywords の中 ( 配列 ) { text": sport", "score": "0.989013 sport の確率が 98.9013% と認識 }, { text": football", football の確率が 98.5226% と認識 "score": "0.985226 } ] } API http://www.alchemyapi.com/api/image-tagging/urls.html 13

API 14 h"p://www.alchemyapi.com/api/image- tagging/urls.html Top Page >> Developers >> Documenta7ons >> Image Tagging >> API Calls >> Web API

URL http://access.alchemyapi.com/calls/url/urlgetrankedimagekeywords?apikey= API Key &outputmode=json &url= URL 15

Alchemy Face Detection 16 h"p://www.alchemyapi.com/products/demo/face- detec7on Top Page >> Products >> Demo >> AlchemyVision Face API Demo

Alchemy Face Detection API URL URL Get http://access.alchemyapi.com/calls/url/urlgetrankedimagefacetags?apikey= API &url= URL &outputmode=json &knowledgegraph=1 17

URLGetRankedImageFaceTags API { "status": "OK", "usage": "By accessing AlchemyAPI or ", "url": "h"p://xxx.com/wp- content/uploads/2015/05/aaaa.jpg", "totaltransac7ons": "5", "imagefaces": [ { age : { "agerange": "18-24", "score": "0.702753 }, "gender": { "gender": "FEMALE", "score": "0.991837 }, "iden7ty": { "knowledgegraph": { "typehierarchy": "/people/ariana grande }, ] } "name": "Ariana Grande", "score": "0.622459" }, "posi7onx": "116", "posi7ony": "19", height : 48, "width": "48 } この API コールで消費したトランザクションは 5 結果は imagefaces の中 ( 配列 ) age: 推定年齢層と その確度 gender: 推定性別と その確度 個人が特定できた場合は iden7ty 内に情報が入り 名前とその確度 posi7onx, posi7ony: 顔の位置 width, height: 顔のサイズ API http://www.alchemyapi.com/api/face-detection/urls.html 18

API 19 h"p://www.alchemyapi.com/api/face- detec7on/urls.html Top Page >> Developers >> Documenta7ons >> Face Detec7on >> API Calls >> Web API

URL http://access.alchemyapi.com/calls/url/urlgetrankedimagefacetags?apikey= API Key &outputmode=json &url= URL 20

URL 21

URL Alchemy Vision Alchemy Face Detect API 22

Bluemix 23

WEB WEB 24

PHP PHP PHP 25

PHP 26

PHP kkimura -php-yyyymmdd 27

30 秒 ~ 1 分 PHP PHP 28

29

PHP 30

PHP PHP 31

(1) PHP URL ***.php?url=http://xxxxxxxx/xxx.jpg (2) URL Alchemy Vision API Alchemy Face Detection API (3) JSON (4) 32

Bluemix 1. Eclipse Eclipse 2. cf 3. IDS(IBM DevOps Services) Git 今回は cf ツールを使った方法を紹介します 33

cf https://github.com/cloudfoundry/cli#downloads Stable Installers Google Github cf 34

cf OS X cf v Mac >> 35

PHP c:\tmp\docroot 36

> cd \tmp\docroot 37

cf cf Bluemix > cf login a https://api.ng.bluemix.net/ cf Bluemix Login Bluemix PHP Space Login Error 38

PHP PHP > notepad image.php 39

image.php (1) <html> <head> <title>alchemyapi </title> </head> <body> <?php $trans1 = 0; $trans2 = 0; $trans1 = $json1->totaltransactions; $imagekeywords = $json1->imagekeywords; if( count( $imagekeywords ) ){?> <h2>keywords</h2> <table border='1'> <tr><th>text</th><th>score</th></tr> <?php 配列の結果をループで 1 つずつ取り出す if( isset( $_GET['url'] ) ){ $apikey = Alchemy API Key '; API key の値 for( $i = 0; $i < count( $imagekeywords ); $i ++ ){ $imagekeyword = $imagekeywords[$i]; $url = $_GET['url']; 画像 URL を取得 $alchemyurl = 'http://access.alchemyapi.com/calls/url/';?> $text = $imagekeyword->text; $score = $imagekeyword->score;?> <img src='<?php echo $url;?>'/> <p/> <tr><td><?php echo $text;?></td><td><?php echo $score;?></td></tr> <?php } 40 <?php $apiurl1 = $alchemyurl. 'URLGetRankedImageKeywords? apikey='. $apikey. '&outputmode=json&url='. urlencode( $url ); $text1 = file_get_contents( $apiurl1 ); $json1 = json_decode( $text1 ); モノ認識 API の URL?> </table> <p/> <?php API を実行して 結果の JSON を取り出す }

41 image.php (2) $apiurl2 = $alchemyurl. 'URLGetRankedImageFaceTags? apikey='. $apikey. '&outputmode=json&knowledgegraph=1&url='. urlencode( $url ); $text2 = file_get_contents( $apiurl2 ); $json2 = json_decode( $text2 ); $trans2 = $json2->totaltransactions; $imagefaces = $json2->imagefaces; if( count( $imagefaces ) ){?> <h2>facetags</h2> <table border='1'> <tr><th>attr</th><th>value</th><th>score</th></tr> <?php for( $i = 0; $i < count( $imagefaces ); $i ++ ){ $imageface = $imagefaces[$i]; $positionx = $imageface->positionx; $positiony = $imageface->positiony; $width = $imageface->width; $height = $imageface->height; $ageo = $imageface->age; $agerange = $ageo->agerange; $agescore = $ageo->score; 顔認識 API の URL API を実行して 結果の JSON を取り出す 配列の結果をループで 1 つずつ取り出す $gendero = $imageface->gender; $gender = $gendero->gender; $genderscore = $gendero->score;?> <tr><th colspan='3'><?php echo $i;?></th></tr> <tr><td>positionx</td><td><?php echo $positionx;?></td><td> </td></tr> <tr><td>positiony</td><td><?php echo $positiony;?></td><td> </td></tr> <tr><td>width</td><td><?php echo $width;?></td><td> </td></tr> <tr><td>height</td><td><?php echo $height;?></td><td> </td></tr> <tr><td>age</td><td><?php echo $agerange;?></td><td><?php echo $agescore;?></td></tr> <tr><td>gender</td><td><?php echo $gender;?></td><td><?php echo $genderscore;?></td></tr> <?php $identityo = $imageface->identity; if( $identityo ){ $name = $identityo->name; $namescore = $identityo->score;?> <tr><td>name</td><td><?php echo $name;?></td><td><?php echo $namescore;?></td></tr>

image.php (3) <?php }?> <?php }?> </table> <p/> <?php }?> <div align='right'> <?php echo $trans1;?> + <?php echo $trans2;?> = <?php echo ($trans1 + $trans2);?> </div> <?php }?> </body> </html> 42

! https://github.com/dotnsf/alchemyapi_php_sample! jqcloud https://github.com/lucaong/jqcloud *.php, *.js, *.css image.php, index.php jqcloud.css, jqcloud-1.0.4.js image.php, index.php apikey API Key 43

PHP 30 秒 ~ 1 分 Bluemix PHP > cf push Blumix PHP 44

PHP 45

image.php URL http://.mybluemix.net/image.php?url= URL 46

index.php URL http://.mybluemix.net/?url= URL 47

!! URL ImageGetRankedImageKeywords API ImageGetRankedImageFaceTags API 48