Personality Box pulls the txt files from your Box acount and allows you to analyze the unique personality traits of each file's author using Watson Personality Insights technology. For sample files, feel free to use either [President Obama's 2015 State of the Union Address] sotu_url or [Moby Dick - Chapter 1] moby_dick_url hosted in our Box account.
This app is meant to serve as a demo to showcase how quickly and easily an app can be built on Bluemix using the Watson Personality Insights and Box services.
*Note: If deploying by this method, the app will fail on first deploy. After this initial failure, you must complete steps 9-12 as described in the section 'Running the app on Bluemix' below for your app to start successfully.
-
Sign up for a [Box account] box_signup_url if you do not have one already.
-
Upload several txt files (we recommend each file contain a minimum of 2000 words) to the root folder of your account.
-
Navigate to the app home page and select 'Sign in with Box' to log in with your Box account.
-
Once your files load, select one to run its contents through the Personality Insights service and see the author's personality breakdown.
-
To view a visualization of the full result set, select the 'Full Personality Graph' button beneath the Big 5 results.
-
If you have a large number of files and you would like to find a specific one, use the search filter in the navigation bar.
-
To log in as a different user, click the logout button in the navigation bar and you will return to the home page.
This an architectural overview of the systems that make this app run.
-
Create a Bluemix Account
Sign up in Bluemix, or use an existing account.
-
Download and install the Cloud-foundry CLI tool
-
Clone the app to your local environment from your terminal using the following command
git clone https://github.com/IBM-Bluemix/box-watson.git
-
cd into this newly created directory
-
Edit the
manifest.yml
file and change the<application-name>
and<application-host>
to something unique.
applications:
- name: box-sample-app-test
framework: node
runtime: node12
memory: 128M
instances: 1
host: box-sample-app-test
The host you use will determinate your application url initially, e.g. <application-host>.mybluemix.net
.
- Connect to Bluemix in the command line tool and follow the prompts to log in.
$ cf api https://api.ng.bluemix.net
$ cf login
- Create the Personality Insights service in Bluemix.
$ cf create-service personality_insights IBM\ Watson\ Personality\ Insights\ Monthly\ Plan personality-insights-box
- Push it to Bluemix. We need to perform additional steps once it is deployed, so we will add the option --no-start argument
$ cf push --no-start
-
Next, you need to sign up for a Box developer account if you do not have one already. You can do this [here] box_dev_signup_url.
-
Once you have created an account, select 'Create a Box Application' from the side panel. Name your app, select the Box Content API, and click 'Create Application'. On the next page you will find your API key and your app's client_id and client_secret, which you will need for the following step.
-
Using the credentials you received in step 9, we will create a user-provided service in Bluemix so that our app can leverage them.
$ cf cups box -p '{"url":"https://api.box.com","apikey":"BOX_API_KEY","client_id":"BOX_CLIENT_ID","client_secret":"BOX_CLIENT_SECRET"}'
Now bind the service to your app.
$ cf bind-service APP_NAME box
- Finally, we need to restage our app to ensure these env variables changes took effect.
$ cf restage APP_NAME
And voila! You now have your very own instance of Personality Box running on Bluemix.
-
Create a Bluemix Account. You will need this to create a Personality Insights service and grab the credentials later on.
Sign up in Bluemix, or use an existing account.
-
If you have not already, [download node.js] download_node_url and install it on your local machine.
-
Clone the app to your local environment from your terminal using the following command
git clone https://github.com/IBM-Bluemix/box-watson.git
-
cd into this newly created directory
-
Install the required npm and bower packages using the following command
npm install
-
Next, you need to sign up for a Box developer account if you do not have one already. You can do this [here] box_dev_signup_url.
-
Once you have created an account, select 'Create a Box Application' from the side panel. Name your app, select the Box Content API, and click 'Create Application'. On the next page you will find your app's client_id and client_secret, which you will need for the following step.
-
Using the credentials you received in step 9, replace the default Box configs in vcap-local.json. After you have done that, create a Personality Insights service using your Bluemix account and replace the corresponding credentials in vcap-local.json.
-
Start your app locally with the following command.
npm start
Your app will be automatically assigned to a port which will be logged to your terminal. To access the app, go to localhost:PORT in your browser. Happy developing!
To troubleshoot your Bluemix app the main useful source of information is the logs. To see them, run:
$ cf logs <application-name> --recent
The Personality Box sample web application includes code to track deployments to Bluemix and other Cloud Foundry platforms. The following information is sent to a [Deployment Tracker] deploy_track_url service on each deployment:
- Application Name (
application_name
) - Space ID (
space_id
) - Application Version (
application_version
) - Application URIs (
application_uris
)
This data is collected from the VCAP_APPLICATION
environment variable in IBM Bluemix and other Cloud Foundry platforms. This data is used by IBM to track metrics around deployments of sample applications to IBM Bluemix. Only deployments of sample applications that include code to ping the Deployment Tracker service will be tracked.
Deployment tracking can be disabled by removing "install": "node admin.js track"
from the scripts
section within package.json
.