Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

DO NOT MERGE #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ SPEECH_TO_TEXT_USERNAME=<add_stt_username>
SPEECH_TO_TEXT_PASSWORD=<add_stt_username>

# Visual Recognition Key
VR_KEY=<add_vr_recognition_key>
VISUAL_RECOGNITION_IAM_APIKEY=<add_apikey>

# Natural Language Understanding Credentials
NATURAL_LANGUAGE_UNDERSTANDING_USERNAME=<add_nlu_username>
Expand Down
2 changes: 1 addition & 1 deletion env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SPEECH_TO_TEXT_USERNAME=<add_stt_username>
SPEECH_TO_TEXT_PASSWORD=<add_stt_username>

# Visual Recognition Key
VR_KEY=<add_vr_recognition_key>
VISUAL_RECOGNITION_IAM_APIKEY=<add_apikey>

# Natural Language Understanding Credentials
NATURAL_LANGUAGE_UNDERSTANDING_USERNAME=<add_nlu_username>
Expand Down
4 changes: 1 addition & 3 deletions lib/mediaprocessor/MediaProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const localMediaURL = `http:https://enrich:enrichit@${appEnv.bind}:${appEnv.port}/`;

log.level = 'debug';

const vrKey = process.env.VR_KEY;
const sttUsername = process.env.STT_USERNAME;
const sttPassword = process.env.STT_PASSWORD;

Expand Down Expand Up @@ -179,7 +178,6 @@ class MediaProcessor extends EventEmitter {
this._do_stt = options.stt;
this.vr_rate = options.vr_rate;
this.wks_model = options.hasOwnProperty('wks_model') ? options.wks_model : null;
this.vr_api_key = options.hasOwnProperty('vr_api_key') ? options.vr_api_key : vrKey;
this.model = options.model ? options.model : 'GAP';
this.timegap = options.timegap ? options.timegap : 5000;
}
Expand Down Expand Up @@ -222,7 +220,7 @@ class MediaProcessor extends EventEmitter {
// NOTE data come in in 'seconds'
if (this._use_vr && data.length > 0) {
log.debug(`Calling Visual Recognition on ${data.length}`);
vr.doVisualRecognition(this.mediaMetadata, data, this.vr_api_key)
vr.doVisualRecognition(this.mediaMetadata, data)
.then((vrResults) => {
if (vrResults) {
log.debug(`Visual Recognition finished: ${vrResults.length}`);
Expand Down
21 changes: 7 additions & 14 deletions lib/mediaprocessor/VisualRecognition.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const uuid = require('node-uuid');
const path = require('path');
const fs = require('fs');
const archiver = require('archiver');
const watson = require('watson-developer-cloud');
const VisualRecognitionV3 = require('watson-developer-cloud/visual-recognition/v3');
const log = require('pino')();

log.level = 'debug';
Expand All @@ -35,13 +35,10 @@ require('dotenv').load({
silent: true,
});

const vrParams = {
api_key: process.env.VR_KEY,
version: 'v3',
version_date: '2016-05-20',
};

let visualRecognition = null;
// Init visualRecognition
const visualRecognition = new VisualRecognitionV3({
version: '2018-03-19',
});

const screenshotDir = './screenshots';

Expand Down Expand Up @@ -374,12 +371,7 @@ function vrFilelist(filelist) {
}

// Main exposed API -- Given mediametadata, and times, VR it.
function doVisualRecognition(mediaMetadata, times, enrich, vrKey) {
if (vrKey) {
vrParams.api_key = vrKey;
}
// Init visualRecognition
visualRecognition = watson.visual_recognition(vrParams);
function doVisualRecognition(mediaMetadata, times) {
return resolveMedia(mediaMetadata)
.then(media => getScreenCaps(media, mediaMetadata.guid, times))
// .then(zipTo15)
Expand All @@ -388,6 +380,7 @@ function doVisualRecognition(mediaMetadata, times, enrich, vrKey) {
log.error('visualRecognition got an Error ', error);
});
}

/*
// called to enrich text
enrichText(text, callback) {
Expand Down
2 changes: 1 addition & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
declared-services:
wma-visual-recognition:
label: watson_vision_combined
plan: free
plan: lite
wma-natural-language-understanding:
label: natural-language-understanding
plan: free
Expand Down
Loading