Giter Club home page Giter Club logo

ibm / nlc-icd10-classifier Goto Github PK

View Code? Open in Web Editor NEW
111.0 20.0 57.0 4.47 MB

A simple web app that shows how Watson's Natural Language Classifier (NLC) can classify ICD-10 code. The app is written in Python using the Flask framework and leverages the Watson Developer Cloud Python SDK

Home Page: https://developer.ibm.com/patterns/classify-icd-10-data-with-watson/

License: Apache License 2.0

HTML 49.11% Python 50.89%
call-for-code nlc watson classifier ibm-cloud watson-python-sdk ibmcode icd-10

nlc-icd10-classifier's Introduction

Build Status

DISCLAIMER: This application is used for demonstrative and illustrative purposes only and does not constitute an offering that has gone through regulatory review. It is not intended to serve as a medical application. There is no representation as to the accuracy of the output of this application and it is presented without warranty.

Classify medical diagnosis with ICD-10 code

This application was built to demonstrate IBM's Watson Natural Language Classifier (NLC). The data set we will be using, ICD-10-GT-AA.csv, contains a subset of ICD-10 entries. ICD-10 is the 10th revision of the International Statistical Classification of Diseases and Related Health Problems. In short, it is a medical classification list by the World Health Organization (WHO) that contains codes for: diseases, signs and symptoms, abnormal findings, complaints, social circumstances, and external causes of injury or diseases. Hospitals and insurance companies alike could save time and money by leveraging Watson to properly tag the most accurate ICD-10 codes.

This application is a Python web application based on the Flask microframework, and based on earlier work done by Ryan Anderson. It uses the Watson Python SDK to create the classifier, list classifiers, and classify the input text. We also make use of the freely available ICD-10 API which, given an ICD-10 code, returns a name and description.

When the reader has completed this pattern, they will understand how to:

  • Create a Natural Language Classifier (NLC) service and use it in a Python application.
  • Train a NLC model using csv data.
  • Deploy a web app with Flask to allow the NLC model to be queried.
  • Quickly get a classification of a disease or health issue using the Natural Language Classifier trained model.

Flow

architecture

  1. CSV files are sent to the Natural Language Classifier service to train the model.
  2. The user interacts with the web app UI running either locally or in the cloud.
  3. The application sends the user's input to the Natural Language Classifier model to be classified.
  4. The information containing the classification is returned to the web app.

Included Components

  • Watson Studio: Analyze data using RStudio, Jupyter, and Python in a configured, collaborative environment that includes IBM value-adds, such as managed Spark.
  • Watson Natural Language Classifier: An IBM Cloud service to interpret and classify natural language with confidence.
  • Python: Python is a programming language that lets you work more quickly and integrate your systems more effectively.

Watch the Video

video

Steps

  1. Clone the repo
  2. Create IBM Cloud services
  3. Create a Watson Studio project
  4. Train the NLC model
  5. Run the application

1. Clone the repo

Clone the nlc-icd10-classifier repo locally. In a terminal, run:

git clone https://github.com/IBM/nlc-icd10-classifier
cd nlc-icd10-classifier

2. Create IBM Cloud services

Create the following service:

3. Create a Watson Studio project

  • Log into IBM's Watson Studio. Once in, you'll land on the dashboard.

  • Create a new project by clicking + New project and choosing Data Science:

    studio project

  • Enter a name for the project name and click Create.

  • NOTE: By creating a project in Watson Studio a free tier Object Storage service and Watson Machine Learning service will be created in your IBM Cloud account. Select the Free storage type to avoid fees.

    studio-new-project

  • Upon a successful project creation, you are taken to a dashboard view of your project. Take note of the Assets and Settings tabs, we'll be using them to associate our project with any external assets (datasets and notebooks) and any IBM cloud services.

    studio-project-dashboard

4. Train the NLC model

The data used in this example is part of the ICD-10 data set and a cleaned version we'll use is available in the repo under data/ICD-10-GT-AA.csv. We'll now train an NLC model using this data.

  • From the new project Overview panel, click + Add to project on the top right and choose the Natural Language Classifier asset type.

    add-nlc-asset

  • A new instance of the NLC tool will launch.

    new-nlc-model

  • Add the data to your project by clicking the Browse button in the right-hand Upload to project section and browsing to the cloned repo. Choose the data/ICD-10-GT-AA.csv file.

  • Select the ICD-10-GT-AA.csv file you just uploaded and choose Add to model.

    add-to-model

  • Click the Train model button to begin training. The model will take around an hour to train.

  • To check the status of the model, and access it after it trains, go to your project in the Assets tab of the Models section. The model will show up when it is ready. Double click to see the Overview tab.

    nlc-model-overview

  • The first line of the Overview tab contains the Model ID, remember this value as we'll need it in the next step.

5. Run the application

Follow the steps below for deploying the application:

Run on IBM Cloud

  • Press the Deploy to IBM Cloud button below.

Deploy to IBM Cloud

  • From the IBM Cloud deployment page click the Deploy button.

  • From the Toolchains menu, click the Delivery Pipeline to watch while the app is deployed. Once deployed, the app can be viewed by clicking View app.

  • The app and service can be viewed in the IBM Cloud dashboard. The app will be named nlc-icd10-classifier, with a unique suffix.

  • We now need to add a few environment variables to the application's runtime so the right classifier service and model are used. Click on the application from the dashboard to view its settings.

  • Once viewing the application, click the Runtime option on the menu and navigate to the Environment Variables section.

  • Update the CLASSIFIER_ID, and NATURAL_LANGUAGE_CLASSIFIER_APIKEY variables with your Model ID from Step 4 and NLC API key from Step 2. Click Save.

    env vars

  • After saving the environment variables, the app will restart. After the app restarts you can access it by clicking the Visit App URL button.

Run locally

The general recommendation for Python development is to use a virtual environment (venv). To install and initialize a virtual environment, use the venv module on Python 3 (you install the virtualenv library for Python 2.7):

  • Create the virtual environment using Python. Use one of the two commands depending on your Python version.

    Note: it may be named python3 on your system.

    python -m venv mytestenv       # Python 3.X
    virtualenv mytestenv           # Python 2.X
  • Now source the virtual environment. Use one of the two commands depending on your OS.

    source mytestenv/bin/activate  # Mac or Linux
    ./mytestenv/Scripts/activate   # Windows PowerShell

    TIP ๐Ÿ’ก To terminate the virtual environment use the deactivate command.

  • Rename the env.example file to .env

    mv env.example .env
  • Update the .env file with the NLC credentials for either username/password or API key

    # Replace the credentials here with your own using either USERNAME/PASSWORD or IAM_APIKEY
    # Comment out the unset environment variables
    # Rename this file to .env before running app.py.
    
    CLASSIFIER_ID=<add_nlc_classifier_id>
    NATURAL_LANGUAGE_CLASSIFIER_APIKEY=<add_nlc_apikey>
  • Install the app dependencies by running:

    pip install -r requirements.txt
  • Start the app by running

    python app.py
  • Open a browser and point to localhost:5000.

Sample Output

The user inputs information into the Text to classify: text box and the Watson NLC classifier will return ICD10 classifications with confidence scores.

Classification of Gastrointestinal hemorrhage: Sample output

Links

Learn more

  • Artificial Intelligence Code Patterns: Enjoyed this Code Pattern? Check out our other AI Code Patterns.
  • AI and Data Code Pattern Playlist: Bookmark our playlist with all of our Code Pattern videos

License

This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

Apache Software License (ASL) FAQ

nlc-icd10-classifier's People

Contributors

dolph avatar imgbot[bot] avatar kant avatar ljbennett62 avatar sanjeevghimire avatar scottdangelo avatar stevemar avatar stevemart avatar tanmayb123 avatar timroster avatar tqtran7 avatar yamachan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nlc-icd10-classifier's Issues

watson-developer-cloud 2.0 breaking changes requires fixes

One error:

[2018-09-25 13:32:39,884] ERROR in app: Exception on /classifyhandler [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "welcome.py", line 61, in classify_text
    CLASSIFIER['classifier_id'], inputtext)
TypeError: 'NoneType' object is not subscriptable
127.0.0.1 - - [25/Sep/2018 13:32:39] "POST /classifyhandler HTTP/1.1" 500 -

I'm unable to start this on Desktop and online...

Hello, Not sure if this is still working but I'm trying to make this work and I'm unable to.

When running it locally I get:

mytestenv) (base) PS F:\Programs\nlc-icd10-classifier> python app.py                                                   Traceback (most recent call last):
  File "app.py", line 34, in <module>
    iam_apikey=nlc_iam_apikey

When running it on Watson Cloud I get this:

Pipeline image: latest
Preparing the build artifacts...
Pulling pipeline base image latest ...
cf login -a "https://api.eu-gb.cf.cloud.ibm.com" -u apikey -p "****" -o "bewinxed" -s "dev" 
API endpoint: https://api.eu-gb.cf.cloud.ibm.com
Authenticating...
OK

Targeted org bewinxed

Targeted space dev



API endpoint:   https://api.eu-gb.cf.cloud.ibm.com (API version: 2.144.0)
User:           [email protected]
Org:            bewinxed
Space:          dev
Pushing from manifest to org bewinxed / space dev as [email protected]...
Using manifest file /home/pipeline/5b17f1f3-034a-4608-a7f9-842e4a1c5fc3/manifest.yml
Deprecation warning: Use of 'buildpack' attribute in manifest is deprecated in favor of 'buildpacks'. Please see https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html#deprecated for alternatives and other app manifest deprecations. This feature will be removed in the future.



Deprecation warning: Route component attributes 'domain', 'domains', 'host', 'hosts' and 'no-hostname' are deprecated. Found: domain.
Please see https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html#deprecated for the currently supported syntax and other app manifest deprecations. This feature will be removed in the future.


Using manifest file /home/pipeline/5b17f1f3-034a-4608-a7f9-842e4a1c5fc3/manifest.yml

Updating app nlc-icd10-classifier-20200205001433954 in org bewinxed / space dev as [email protected]...
OK

Using route nlc-icd10-classifier-20200205001433954.eu-gb.mybluemix.net
Uploading nlc-icd10-classifier-20200205001433954...
Uploading app files from: /home/pipeline/5b17f1f3-034a-4608-a7f9-842e4a1c5fc3
Uploading 40K, 26 files

                             
Done uploading
OK

Stopping app nlc-icd10-classifier-20200205001433954 in org bewinxed / space dev as [email protected]...
OK

Starting app nlc-icd10-classifier-20200205001433954 in org bewinxed / space dev as [email protected]...
Downloading python_buildpack...
Downloaded python_buildpack
Cell 93031588-3d1d-4920-9a21-7490000a2b07 creating container for instance 239c2935-947e-4316-bd46-b2a73fa7b645
Cell 93031588-3d1d-4920-9a21-7490000a2b07 successfully created container for instance 239c2935-947e-4316-bd46-b2a73fa7b645
Downloading app package...
Downloading build artifacts cache...
Downloaded build artifacts cache (35.8M)
Downloaded app package (2.5M)
-----> Python Buildpack version 1.7.2
-----> Supplying Python
-----> Installing python 2.7.17
       Copy [/tmp/cache/final/dependencies/1c95d2653927c4480a843cc409b4ad10d0c4731956ed9d6eb0b8044213d460dd/python-2.7.17-linux-x64-cflinuxfs3-7061c97e.tgz]
       **WARNING** python 2.7.x will no longer be available in new buildpacks released after 2020-01-01.
       See: https://www.python.org/dev/peps/pep-0373/
-----> Installing pip-pop 0.1.4
       Copy [/tmp/cache/final/dependencies/3b86fb2cd9c13268f8858fd0ccb2f9eaf11295a51804b7075fe38d7e2a471191/pip-pop-0.1.4-0a3b0f1b.tar.gz]
-----> Running Pip Install
       DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
       Collecting python-dotenv (from -r /tmp/app/requirements.txt (line 1))
         Using cached https://files.pythonhosted.org/packages/f7/cb/b6c5c6e3e2d6ee3268dcf1b027979ac8927914b12d8a7f11f491df0e82a7/python_dotenv-0.10.5-py2.py3-none-any.whl
       Collecting Flask (from -r /tmp/app/requirements.txt (line 2))
         Using cached https://files.pythonhosted.org/packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl
       Collecting ibm-watson (from -r /tmp/app/requirements.txt (line 3))
         Using cached https://files.pythonhosted.org/packages/da/f4/7e256026ee22c75a630c6de53eb45b6fef4840ac6728b80a92dd2e523a1a/ibm-watson-4.2.1.tar.gz
       Collecting typing; python_version < "3.5" (from python-dotenv->-r /tmp/app/requirements.txt (line 1))
         Using cached https://files.pythonhosted.org/packages/22/30/64ca29543375759dc589ade14a6cd36382abf2bec17d67de8481bc9814d7/typing-3.7.4.1-py2-none-any.whl
       Collecting Werkzeug>=0.15 (from Flask->-r /tmp/app/requirements.txt (line 2))
         Using cached https://files.pythonhosted.org/packages/c2/e4/a859d2fe516f466642fa5c6054fd9646271f9da26b0cac0d2f37fc858c8f/Werkzeug-0.16.1-py2.py3-none-any.whl
       Collecting click>=5.1 (from Flask->-r /tmp/app/requirements.txt (line 2))
         Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
       Collecting Jinja2>=2.10.1 (from Flask->-r /tmp/app/requirements.txt (line 2))
         Using cached https://files.pythonhosted.org/packages/27/24/4f35961e5c669e96f6559760042a55b9bcfcdb82b9bdb3c8753dbe042e35/Jinja2-2.11.1-py2.py3-none-any.whl
       Collecting itsdangerous>=0.24 (from Flask->-r /tmp/app/requirements.txt (line 2))
         Using cached https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
       Collecting requests<3.0,>=2.0 (from ibm-watson->-r /tmp/app/requirements.txt (line 3))
         Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
       Collecting python_dateutil>=2.5.3 (from ibm-watson->-r /tmp/app/requirements.txt (line 3))
         Using cached https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl
       Collecting websocket-client==0.48.0 (from ibm-watson->-r /tmp/app/requirements.txt (line 3))
         Using cached https://files.pythonhosted.org/packages/8a/a1/72ef9aa26cfe1a75cee09fc1957e4723add9de098c15719416a1ee89386b/websocket_client-0.48.0-py2.py3-none-any.whl
       Collecting ibm_cloud_sdk_core==1.5.1 (from ibm-watson->-r /tmp/app/requirements.txt (line 3))
         Using cached https://files.pythonhosted.org/packages/b7/f6/10d5271c807d73d236e6ae07b68035fed78b28b5ab836704d34097af3986/ibm-cloud-sdk-core-1.5.1.tar.gz
       Collecting MarkupSafe>=0.23 (from Jinja2>=2.10.1->Flask->-r /tmp/app/requirements.txt (line 2))
         Using cached https://files.pythonhosted.org/packages/fb/40/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
       Collecting chardet<3.1.0,>=3.0.2 (from requests<3.0,>=2.0->ibm-watson->-r /tmp/app/requirements.txt (line 3))
         Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
       Collecting idna<2.9,>=2.5 (from requests<3.0,>=2.0->ibm-watson->-r /tmp/app/requirements.txt (line 3))
         Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
       Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests<3.0,>=2.0->ibm-watson->-r /tmp/app/requirements.txt (line 3))
         Using cached https://files.pythonhosted.org/packages/e8/74/6e4f91745020f967d09332bb2b8b9b10090957334692eb88ea4afe91b77f/urllib3-1.25.8-py2.py3-none-any.whl
       Collecting certifi>=2017.4.17 (from requests<3.0,>=2.0->ibm-watson->-r /tmp/app/requirements.txt (line 3))
         Using cached https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl
       Collecting six>=1.5 (from python_dateutil>=2.5.3->ibm-watson->-r /tmp/app/requirements.txt (line 3))
         Using cached https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
       Collecting PyJWT>=1.7.1 (from ibm_cloud_sdk_core==1.5.1->ibm-watson->-r /tmp/app/requirements.txt (line 3))
         Using cached https://files.pythonhosted.org/packages/87/8b/6a9f14b5f781697e51259d81657e6048fd31a113229cf346880bb7545565/PyJWT-1.7.1-py2.py3-none-any.whl
       Installing collected packages: typing, python-dotenv, Werkzeug, click, MarkupSafe, Jinja2, itsdangerous, Flask, chardet, idna, urllib3, certifi, requests, six, python-dateutil, websocket-client, PyJWT, ibm-cloud-sdk-core, ibm-watson
         WARNING: The script dotenv is installed in '/tmp/contents197645253/deps/0/python/bin' which is not on PATH.
         Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
         WARNING: The script flask is installed in '/tmp/contents197645253/deps/0/python/bin' which is not on PATH.
         Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
         WARNING: The script chardetect is installed in '/tmp/contents197645253/deps/0/python/bin' which is not on PATH.
         Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
         WARNING: The script pyjwt is installed in '/tmp/contents197645253/deps/0/python/bin' which is not on PATH.
         Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
         Running setup.py install for ibm-cloud-sdk-core: started
           Running setup.py install for ibm-cloud-sdk-core: finished with status 'done'
         Running setup.py install for ibm-watson: started
           Running setup.py install for ibm-watson: finished with status 'done'
       Successfully installed Flask-1.1.1 Jinja2-2.11.1 MarkupSafe-1.1.1 PyJWT-1.7.1 Werkzeug-0.16.1 certifi-2019.11.28 chardet-3.0.4 click-7.0 ibm-cloud-sdk-core-1.5.1 ibm-watson-4.2.1 idna-2.8 itsdangerous-1.1.0 python-dateutil-2.8.1 python-dotenv-0.10.5 requests-2.22.0 six-1.14.0 typing-3.7.4.1 urllib3-1.25.8 websocket-client-0.48.0
       WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
       You should consider upgrading via the 'pip install --upgrade pip' command.
Exit status 0
Uploading droplet, build artifacts cache...
Uploading droplet...
Uploading build artifacts cache...
Uploaded build artifacts cache (35.8M)
Uploaded droplet (39.4M)
Uploading complete
Cell 93031588-3d1d-4920-9a21-7490000a2b07 stopping instance 239c2935-947e-4316-bd46-b2a73fa7b645
Cell 93031588-3d1d-4920-9a21-7490000a2b07 destroying container for instance 239c2935-947e-4316-bd46-b2a73fa7b645
Cell 93031588-3d1d-4920-9a21-7490000a2b07 successfully destroyed container for instance 239c2935-947e-4316-bd46-b2a73fa7b645

0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 crashed
FAILED
Error restarting application: Start unsuccessful

TIP: use 'cf logs nlc-icd10-classifier-20200205001433954 --recent' for more information

Finished: FAILED```

Support for service in Frankfort

To support a NLC instance in Frankfurt with apikey:

  • I've added a line in the .env file and commented the password line
    NATURAL_LANGUAGE_CLASSIFIER_USERNAME=apikey
    /#/ NATURAL_LANGUAGE_CLASSIFIER_PASSWORD=<add_NLC_password>
    NATURAL_LANGUAGE_CLASSIFIER_IAM_APIKEY='xxxxxxxxx....xxx'
    NATURAL_LANGUAGE_CLASSIFIER_URL='https://gateway-fra.watsonplatform.net/natural-language-classifier/api'

  • I've modified the welcome.py file (the line with the url)

image

image

and
image

Not sure it's enough, but at least my credentials are recognised .
As the model is not trained yet , I still have an error :
image

trouble getting started with watson nlc

mytestenv) (base) C:\Users\mohana.kalyan\Desktop\ibm3\nlc-icd10-classifier>curl -i -u "apikey:###############################################
cass2
" ^
More? -F training_data=C:\Users\mohana.kalyan\Desktop\ibm3\nlc-icd10-classifier\data\ICD-10-GT-AA.csv ^
More? -F training_metadata="{"language":"en","name":"ICD_classifier"}" ^
More? "https://gateway-fra.watsonplatform.net/natural-language-classifier/api/v1/classifiers"
HTTP/1.1 400 Bad Request
X-Backside-Transport: FAIL FAIL
Content-Type: application/json
X-XSS-Protection: 1
Content-Security-Policy: default-src 'none'
X-Content-Type-Options: nosniff
Cache-Control: no-cache, no-store
Pragma: no-cache
Expires: 0
x-global-transaction-id: 0e7fa6da5c655d2728bf7de9
X-DP-Watson-Tran-ID: gateway-fra-dp02-683638249
X-DP-Transit-ID: gateway-fra-dp02-683638249
Strict-Transport-Security: max-age=31536000;
Content-Length: 121
Date: Thu, 14 Feb 2019 12:20:56 GMT
Connection: close

{
"code" : 400,
"error" : "Malformed data",
"description" : "The 'class' value at line 1 and column 1 is 'null'."
}
(mytestenv) (base) C:\Users\mohana.kalyan\Desktop\ibm3\nlc-icd10-classifier>

this is the error i am getting after following each step in github repo for IBM Watson nlc/icd10

kindly respond.Its urgent

App crash due to dependency problem in watson developer python 2.0.0 sdk

Deploying the application to Cloud Foundry fails due to dependency issues in version 2.0 of python sdk. Log messages from deployment showing the crash:

   2018-10-26T09:41:03.75-0700 [API/11] OUT App instance exited with guid 18870f06-7ee1-478b-b9fd-d1905cfaef95 payload: {"instance"=>"1b371d86-815b-426e-71ea-47d6", "index"=>0, "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1", "crash_count"=>1, "crash_timestamp"=>1540572064653082121, "version"=>"7662cd2d-d2c1-4e89-bf3e-7890e066945b"}
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR Traceback (most recent call last):
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR   File "welcome.py", line 19, in <module>
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR     from watson_developer_cloud import NaturalLanguageClassifierV1
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR   File "/home/vcap/deps/0/python/lib/python2.7/site-packages/watson_developer_cloud/__init__.py", line 32, in <module>
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR     from .speech_to_text_v1_adapter import SpeechToTextV1Adapter as SpeechToTextV1
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR   File "/home/vcap/deps/0/python/lib/python2.7/site-packages/watson_developer_cloud/speech_to_text_v1_adapter.py", line 1, in <module>
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR     from watson_developer_cloud.websocket import RecognizeCallback, RecognizeListener, AudioSource
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR   File "/home/vcap/deps/0/python/lib/python2.7/site-packages/watson_developer_cloud/websocket/__init__.py", line 18, in <module>
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR     from .recognize_listener import RecognizeListener
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR   File "/home/vcap/deps/0/python/lib/python2.7/site-packages/watson_developer_cloud/websocket/recognize_listener.py", line 17, in <module>
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR     import websocket
   2018-10-26T09:41:04.34-0700 [APP/PROC/WEB/0] ERR ImportError: No module named websocket
   2018-10-26T09:41:04.42-0700 [APP/PROC/WEB/0] OUT Exit status 1
   2018-10-26T09:41:04.43-0700 [CELL/SSHD/0] OUT Exit status 0

The requirements.txt file is set to use version 2.0 and not later versions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.