Summary
IRIS-GenLab is a generative AI Application that leverages the functionality of Flask web framework, SQLALchemy ORM, and InterSystems IRIS to demonstrate Machine Learning, LLM, NLP, Generative AI API, Google AI LLM, Flan-T5-XXL model, Flask Login and OpenAI ChatGPT use cases.
Features
- User registration and authentication
- Chatbot functionality with the help of Torch (python machine learning library)
- Named entity recognition (NER), natural language processing (NLP) method for text information extraction
- PEX production to apply Named entity recognition (NER) on the given text
- Sentiment analysis, NLP approch that identifies the emotional tone of the message
- HuggingFace Text generation with the help of GPT2 LLM (Large Language Model) model and Hugging Face pipeline
- Google PALM API, to access the advanced capabilities of Google’s large language models (LLM) like PaLM2
- Google Flan-T5 XXL, a fine-tuned on a large corpus of text data that was not filtered for explicit contents.
- OpenAI is a private research laboratory that aims to develop and direct artificial intelligence (AI)
Installation
- Clone/git pull the repo into any local directory
git clone https://github.com/mwaseem75/iris-GenLab.git
- Open a Docker terminal in this directory and run:
docker-compose build
- Run the IRIS container:
docker-compose up -d
Getting Started
Open myconfig.py file in python/genlab folder and enter the required keys (For where to get theses keys, please read section below)
To Run Flask application
Run the below command in Git Bash terminal
docker-compose exec iris bash
Now run below command to start flask application
irispython ./python/app.py
To run the application Navigate to http://localhost:4040
Home Page
Register a User
To register a user, Click on Sign Up link
Once registered, the user will log in automatically, To sign out click on the User Name link and then click on Sign out.
In order to log in, click on Login link
Chatbot functionality with the help of Torch (python machine learning library)
Click on chatbot icon to start chating
Named entity recognition (NER)
Named entity recognition with spaCy, a open-source library for Natural Language Processing (NLP) in Python
PEX production to apply Named entity recognition (NER) on the given text
The repository already has running production, To view the production navigate to the below URL
http://localhost:55038/csp/irisapp/EnsPortal.ProductionConfig.zen?$NAMESPACE=IRISAPP
Select Python.NERService and go to the message viewer from the messages tab
Click on View raw content to view message details
The message displays NER text(selftext) along with the actual message
Sentiment analysis
Sentiment analysis, also referred to as opinion mining, is an approach to natural language processing (NLP) that identifies the emotional tone of the message
HuggingFace, Text generation (Gpt-2)
Text generation with the help of GPT2 LLM (Large Language Model) model and Hugging Face pipeline
Google PALM API
Google API to access the advanced capabilities of Google’s large language models (LLM) like PaLM2 with the PaLM API
Google PALM API requires [PALM_API_KEY] key
How to get Google Palm Api key
Navigate to Google Palm Api Key page, Click on “Create API Key in new project” and get API Key
Google Flan-T5-XXL
Flan-T5 is fine-tuned on a large corpus of text data that was not filtered for explicit content. Mainly used for Translation and question-answering
Google Flan-T5-XXl requires [HUGGINGFACEHUB_API_TOKEN] key
How to get Hugging Face key
Signup with hugging face and navigate to setting Hugging Face account settings, click on the new token to create a new token
OpenAI
OpenAI is a private research laboratory that aims to develop and direct artificial intelligence (AI)
Get OpenAI Key [OPENAI_API_KEY]
Application requires OpenAI API Key, sign up for OpenAI API on this page. Once you signed up and logged in, click on Personal, and select View API keys in drop-down menu. Create and copy the API Key
Application database
SQLALchemy will create below table:
- user: To store User information
To view table details, navigate to
http://localhost:55038/csp/sys/exp/%25CSP.UI.Portal.SQL.Home.zen?$NAMESPACE=USER&
Special Thanks to:
Evgeny Shvarov for iris-embedded-python-template and
Guillaume Rongier for interoperability-embedded-python template for guidance