Skip to content

Instantly share code, notes, and snippets.

@TakesxiSximada
Last active August 29, 2015 14:18
Show Gist options
  • Save TakesxiSximada/8cf621d18404ea75a081 to your computer and use it in GitHub Desktop.
Save TakesxiSximada/8cf621d18404ea75a081 to your computer and use it in GitHub Desktop.
Bluemix のVisual Recognitionでラベルを取得
# -*- coding: utf-8 -*-
import requests
recog_data = {
"visual_recognition": [
{
"name": "Visual Recognition-1o",
"label": "visual_recognition",
"plan": "free",
"credentials": {
"url": "https://gateway.watsonplatform.net/visual-recognition-beta/api",
"username": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
"password": "xxxxxxxxxxxxxxxx"
}}]}
base_url = recog_data["visual_recognition"][0]['credentials']['url']
username = recog_data["visual_recognition"][0]['credentials']['username']
password = recog_data["visual_recognition"][0]['credentials']['password']
url = base_url + '/v1/tag/labels'
res = requests.get(
url,
auth=(username, password),
headers={'content-type': 'application/json'},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment