Simplified Question Answering Machine
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file SQAM-0.1.0.tar.gz.
File metadata
- Download URL: SQAM-0.1.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
629a6a4a1ddd1a292970ce980375f1ce212362f307bb59bf99dfaf5e290b017a
|
|
| MD5 |
1fa1bf35c7315dc43b3861db6260eca0
|
|
| BLAKE2b-256 |
0190f0e44dd2e2fdd57c332017f01b17e48417f57482cf7a42b3e1cef2d1916c
|
File details
Details for the file SQAM-0.1.0-py3-none-any.whl.
File metadata
- Download URL: SQAM-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b0c915fa2de127c8ebda6cf4994f35d892c85e81191d69a88ccbb26995b3651
|
|
| MD5 |
aa1852f289c03a2ac3246fefbfda0ff8
|
|
| BLAKE2b-256 |
c0d3c77b673320e19bc5e8a6653f8abd712b478a21db4930ee5c2e9a19f660c4
|