SQAM - Simplified Question Answering Machine
Here is a DEMO VERSION
Abstract
SQAM - Simplified Question Answering Machine is a light weight service for question answering using predefined question-answer pairs in a json database. The application tokenizes the user question using 384 dimensional SBERT embeddings and finds the first n-nearest predefined questions outputting the pair question-answer, the rank and the similarity score. This approach is very usefull for lightweight application where user will have limited number of domain specific questions. The example database consists of around 1000 predefined questions about Data Science, Machine Learning and Deep Learning.
Install
Clone the repo git clone https://github.com/preslaff/SQAM.git and install the dependencies with pip install -r requirements.txt
How it works
SQAM uses the app.py flask application to embed, calculate the cosine similarity and then serve the closest to the user request, predefined question-answer pairs. When started, the app scans the directory where it resides for all json files and uses them as static database for question answering. Start the app with python app.py and then you can get answers with a front end of your choice or with curl ex.:
curl -X POST http://127.0.0.1:5000/get_answers -H "Content-Type: application/json" -d '{"question": "What is Machine Learning?"}'
Offline use
You can use the app in offline mode (without Internet connection) if you save the embeddings:
np.save('question_embeddings.npy', question_embeddings)
and when the app is initialized and the model is cached load them with:
question_embeddings = np.load('question_embeddings.npy')
After this step, the app can operate in offline, standalone local mode.
Metadata
Release files for SQAM 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| SQAM-0.1.0.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| SQAM-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.6 kB
Release files / SQAM-0.1.0.tar.gz
| Download URL | SQAM-0.1.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
629a6a4a1ddd1a292970ce980375f1ce212362f307bb59bf99dfaf5e290b017a
|
|
BLAKE2b-256 checksum How to use checksums |
0190f0e44dd2e2fdd57c332017f01b17e48417f57482cf7a42b3e1cef2d1916c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.0
|
Release files / SQAM-0.1.0-py3-none-any.whl
| Download URL | SQAM-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b0c915fa2de127c8ebda6cf4994f35d892c85e81191d69a88ccbb26995b3651
|
|
BLAKE2b-256 checksum How to use checksums |
c0d3c77b673320e19bc5e8a6653f8abd712b478a21db4930ee5c2e9a19f660c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.0
|