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

Commit

Permalink
feat: Add semantic releases and IAM support
Browse files Browse the repository at this point in the history
  • Loading branch information
germanattanasio committed Jul 20, 2018
1 parent 813feae commit 47869e0
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 341 deletions.
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ env:
- BX_SPACE=demos
before_deploy: npm install -g bx-blue-green
deploy:
- provider: script
skip_cleanup: true
provider: script
script:
- bx-blue-green-travis
on:
branch: master
repo: watson-developer-cloud/your-celebrity-match
notifications:
email: false
- provider: script
skip_cleanup: true
script: npx semantic-release
on:
node: 8
60 changes: 26 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# your-celebrity-match
[![Build Status](https://travis-ci.org/watson-developer-cloud/your-celebrity-match.svg?branch=master)](https://travis-ci.org/watson-developer-cloud/your-celebrity-match)

<h1 align="center" style="border-bottom: none;">🚀 Your Celebrity Match</h1>
<h3 align="center">Find celebrities who personality is similar to yours.
</h3>
<p align="center">
<a href="http://travis-ci.org/watson-developer-cloud/personality-insights-nodejs">
<img alt="Travis" src="https://travis-ci.org/watson-developer-cloud/personality-insights-nodejs.svg?branch=master">
</a>
<a href="#badge">
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
</a>
</p>
</p>
The application uses IBM Watson [Personality Insights][pi_docs] and Twitter to find the celebrities that are similar to your personality. Twitter is being use to get the tweets for a given handler, the text from those tweets is send to Personality Insights, who analyze the text and reply with a personality profile. That profile is compared to celebrity profiles to find the most similar.

Live demo: http://your-celebrity-match.ng.bluemix.net/
Expand All @@ -18,6 +27,18 @@ Steps |
<img src="http://s7.postimg.org/nmy8g64ij/4_compare_results.gif" alt="Compares your Personality Insights profile to 232 celebrity profiles analyzed with the service." width="100px" height="100px"><br> Compares your Personality Insights profile to 232 celebrity profiles analyzed with the service.<br> |
<img src="http://s7.postimg.org/we59afntn/5_celeb_match.png" alt="Sorts your matches and shows you the highest and lowest. These are calculated by the euclidean distance between the two." width="100px" height="100px"><br> Sorts your matches and shows you the highest and lowest. These are calculated by the euclidean distance between the two.<br> |

## Prerequisites

1. Sign up for an [IBM Cloud account](https://console.bluemix.net/registration/).
1. Download the [IBM Cloud CLI](https://console.bluemix.net/docs/cli/index.html#overview).
1. Create an instance of the Language Translator service and get your credentials:
- Go to the [Personality Insights](https://console.bluemix.net/catalog/services/personality-insights) page in the IBM Cloud Catalog.
- Log in to your IBM Cloud account.
- Click **Create**.
- Click **Show** to view the service credentials.
- Copy the `apikey` value, or copy the `username` and `password` values if your service instance doesn't provide an `apikey`.
- Copy the `url` value.


## Getting Started

Expand Down Expand Up @@ -61,6 +82,8 @@ This instructions will help you install the celebrities app in your local enviro
url: '<url>',
username: '<username>',
password: '<password>'
// If your credentials have an apikey field use
// iam_apikey: '<apikey>',
},
twitter: [{
Expand Down Expand Up @@ -92,37 +115,6 @@ This instructions will help you install the celebrities app in your local enviro
where `username` is the Twitter handle of the celebrity you would like to add.


## Personality Insights Credentials
The credentials for the services are stored in the [VCAP_SERVICES][vcap_environment] environment variable. In order to get them you need to first create and bind the service to your application.

There are two ways to get the credentials, you can use Bluemix to access your app and view the `VCAP_SERVICES` there or you can run:

```sh
$ cf env <application-name>
```

Example output:

```
System-Provided:
{
"VCAP_SERVICES": {
"personality_insights": [{
"credentials": {
"password": "<password>",
"url": "<url>",
"username": "<username>"
},
"label": "personality_insights",
"name": "personality-insights-service",
"plan": "tiered"
}]
}
}
```

You need to copy `username`, `password`.

## Celebrities
The application comes with two 'celebrity' profiles: [@germanatt][german_twitter] and [@nfriedly][nathan_twitter]. If you want to add more profiles, you have two options:

Expand Down
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var express = require('express'),
app = express(),
config = require('./config/config'),
mongoose = require('mongoose'),
watson = require('watson-developer-cloud'),
PersonalityInsightsV3 = require('watson-developer-cloud/personality-insights/v3'),
TwitterHelper = require('./app/util/twitter-helper');


Expand Down Expand Up @@ -54,7 +54,7 @@ require('./config/express')(app);
var twit = new TwitterHelper(config.twitter);

// Create the personality insights service
var personality_insights = new watson.personality_insights(config.personality_insights);
var personality_insights = new PersonalityInsightsV3(config.personality_insights);

// Make the services accessible to the router
app.use(function(req,res,next){
Expand Down
2 changes: 1 addition & 1 deletion config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {

// Personality Insights credentials
personality_insights: {
version: 'v2'
version: 'v3'
},

// Twitter app credentials: https://apps.twitter.com/app
Expand Down
Loading

0 comments on commit 47869e0

Please sign in to comment.