Skip to content

The Hasura Project Repository for the Watson Natural Language Classifier

Notifications You must be signed in to change notification settings

HPDF-64/Hasura_NLC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Watson: Natural Language Classifier

This is a simple application that enables text classification using IBM Watson's Natural Language Understanding.

Features

  • Recieves text from the user through a minimalist interface.
  • Provides three possible classifications for the inputted text.
  • Provides a confidence value for each of the classifications.

The application builds on top of the Natural Language Understanding API developed by IBM.

Codebase Structure

All of the backend code is in one file that you can read at: /Python-Flask/microservices/watson/src/server.py

All of the frontend code is in one file that you can read at: /React_Native/App.js

Backened API Use Guide

  • Send a POST request payload to Flask backend at /

  • Request Format:

    {
      method: "POST",
      headers: {
       "Accept": "application/json",
       "Content-Type": "multipart/form-data"
      },
      body: <payload>
    }    
    
  • The Payload must contain a key value pair "text":"Text to be analyzed here"

  • The backend returns the computed result in the form of JSON. Example JSON:

    {
        " categories ": [
            {
            " label ": "/ technology and computing
            / software / databases " ,
            " score ": 0.436991
            },
            {
            " label ": "/ technology and computing
            / programming languages / java " ,
            " score ": 0.311278
            },
            {
            " label ": "/ health and fitness / disease
            / headaches and migraines " ,
            " score ": 0.259054
            }
        ],
        " language ": " en " ,
        " usage ": {
            " features ": 1 ,
            " text_characters ": 300 ,
            " text_units ": 1
        }
    }

Frontend Application

  • Simply download and install the application found at /React_Native/app-release-Flask.apk for the Backend with Python Flask or

  • Install the application found at /React_Native/app-release-Express.apk for the Backend with Python Flask

  • Input the text to be classified into the given textbox.

  • Tap Analyze to receive your results.

For Modifying & Running the React Native App (Flask)

  • Go Inside /React_Native and rename App-Flask.js as App.js and run
    npm install
  • For Android in terminal type in
    react-native run-android 
  • For iOS in terminal type in
    react-native run-ios 

For Modifying & Running the React Native App (Express)

  • Go Inside /React_Native and rename App-Express.js as App.js and run
    npm install
  • For Android in terminal type in
    react-native run-android 
  • For iOS in terminal type in
    react-native run-ios 

For Deployment

  • In /Python-Flask/microservices/watson/src/server.py replace the username and password with your IBM BlueMix credentials.
  • Push these changes to your Hasura cluster using Hasura's CLI.
    $ git add .
    $ git commit -m "<Commit Message>"
    $ git push hasura master
    

Support

In case of any bugs, issues or feature requests, feel free to raise an issue. We will try to work on it as soon as possible.

About

The Hasura Project Repository for the Watson Natural Language Classifier

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •