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
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: omatar@asu.edu
Org: bewinxed
Space: dev
Pushing from manifest to org bewinxed / space dev as omatar@asu.edu...
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 omatar@asu.edu...
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 omatar@asu.edu...
OK
Starting app nlc-icd10-classifier-20200205001433954 in org bewinxed / space dev as omatar@asu.edu...
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```
@Bewinxed please try this again, the watson SDK had changed. I updated the code + instructions to use the latest version of the SDK (see #45) and pinned it at that version so it doesn't happen again.
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:
When running it on Watson Cloud I get this: