-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
952fc30
commit 2bb4591
Showing
17 changed files
with
176 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
venv/ | ||
docs/ | ||
corpora/ | ||
README.md | ||
deploy.bash | ||
LICENSE | ||
*.egg-info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ corpora/RoadFTS5_EU.NDS | |
.idea | ||
__pycache__ | ||
logs | ||
models/checkpoint | ||
models/checkpoint | ||
*.egg-info | ||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM python:3.6-buster | ||
|
||
RUN pip install uwsgi | ||
|
||
ADD requirements.txt /ds9/requirements.txt | ||
RUN cd /ds9 && pip install -r requirements.txt | ||
|
||
ADD . /ds9 | ||
RUN cd /ds9 && pip install -e . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,41 @@ | ||
deep-spell-v1.0rc | ||
================= | ||
Deep-Spell-9 | ||
============ | ||
|
||
The Deep-Spell-9 project contains implementations of various neural algorithms, | ||
which enable natural auto-suggestion via deep neural networks. | ||
## About | ||
|
||
## Dependencies | ||
Deep-Spell-9 enables natural auto-completion and matching of geographic queries via deep neural networks. | ||
|
||
Mandatory: | ||
* python 3.x | ||
* tensorflow >= 1.3 | ||
* unidecode | ||
* flask | ||
* scipy | ||
 | ||
|
||
Optional: | ||
* pygtrie (for FTS5 baseline) | ||
* hat_trie (for generating Symspell DAWG) | ||
* DAWG (for generating/loading Symspell DAWG) | ||
## Web service | ||
|
||
## Scripts | ||
An interactive user interface is provided which allows | ||
you to run Deep-Spell-9 within an interactive browser UI. | ||
Use the `service.json` config file to configure the used models. | ||
|
||
### `python3 service.py` | ||
You have to options to launch the service: | ||
|
||
Launches the Deep Spell demonstrator web interface from the | ||
`modules/deepspell_service` flask module. Use the adjacent | ||
`service.json` config file to set the served port and models, | ||
among other options. | ||
1. Via a local Python setup: Clone the repo, and run | ||
|
||
```bash | ||
cd [clone-directory] | ||
pip install -e . | ||
# Port defaults to 8091 | ||
./serve.bash [port] | ||
``` | ||
|
||
2. Via Docker: | ||
|
||
```bash | ||
docker run --rm -it -p 8091:8091 \ | ||
"ghcr.io/klebert-engineering/ds9:latest" \ | ||
"//ds9/serve.bash" | ||
``` | ||
|
||
**Note:** The default `service.json` in the image does not | ||
provide an FTS database to match a query to ranked results, | ||
so you will only be able to see the classifier and completer | ||
components in action. | ||
|
||
After the service is started, open localhost on the | ||
specified port in any browser ([localhost:8091](http://localhost:8091)) by default. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2022.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env bash | ||
|
||
image_name="ds9" | ||
version=$(head -n 1 "VERSION") | ||
push="" | ||
latest="" | ||
test="" | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
-i|--image-name) | ||
image_name=$2 | ||
shift | ||
shift | ||
;; | ||
-v|--version) | ||
version=$2 | ||
shift | ||
shift | ||
;; | ||
-p|--push) | ||
push="yes" | ||
shift | ||
;; | ||
-l|--latest) | ||
latest="yes" | ||
shift | ||
;; | ||
-t|--test) | ||
test="yes" | ||
shift | ||
;; | ||
esac | ||
done | ||
|
||
image_name="ghcr.io/klebert-engineering/$image_name" | ||
docker build -t "$image_name:$version" . | ||
|
||
if [[ -n "$latest" ]]; then | ||
echo "Tagging latest." | ||
docker tag "$image_name:$version" "$image_name:latest" | ||
fi | ||
|
||
if [[ -n "$push" ]]; then | ||
echo "Pushing." | ||
docker push "$image_name:$version" | ||
if [[ -n "$latest" ]]; then | ||
docker push "$image_name:latest" | ||
fi | ||
fi | ||
|
||
if [[ -n "$test" ]]; then | ||
echo "Running test." | ||
docker run --rm -it \ | ||
-p 8091:8091 \ | ||
"$image_name:$version" \ | ||
"//ds9/serve.bash" | ||
fi | ||
py |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
tensorflow==1.9 | ||
unidecode | ||
flask | ||
scipy | ||
DAWG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
export MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
used_server_port="${1:-8091}" | ||
|
||
# Determine python virtual environment | ||
VIRTUAL_ENV_ARG=() | ||
if [[ -d "$VIRTUAL_ENV" ]]; then | ||
VIRTUAL_ENV_ARG=(--virtualenv "$VIRTUAL_ENV") | ||
fi | ||
|
||
# Hand over to UWSGI HTTP server | ||
cd "$MY_DIR" | ||
exec uwsgi \ | ||
"${VIRTUAL_ENV_ARG[@]}" \ | ||
--processes 4 \ | ||
--enable-threads \ | ||
--http ":$used_server_port" \ | ||
--wsgi-file "service.py" \ | ||
--callable app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
|
||
import json | ||
import codecs | ||
import os | ||
import sys | ||
|
||
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/modules") | ||
|
||
import deepspell_service | ||
|
||
with codecs.open("service.json") as config_file: | ||
params = json.load(config_file) | ||
|
||
deepspell_service.views.init(params) | ||
deepspell_service.app.run(host=params["host"], port=params["port"]) | ||
app = deepspell_service.app | ||
|
||
if __name__ == "__main__": | ||
deepspell_service.app.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import setuptools | ||
|
||
with open("requirements.txt", "r") as fh: | ||
requirements = fh.readlines() | ||
|
||
with open("VERSION", "r") as v: | ||
version = v.read().strip() | ||
|
||
setuptools.setup( | ||
name="deep-spell-9", | ||
version=version, | ||
author="Klebert Engineering", | ||
author_email="[email protected]", | ||
description="Neural geographic query processor.", | ||
url="https://github.com/klebert-engineering/deep-spell-9", | ||
packages=setuptools.find_packages("modules"), | ||
package_dir={'': 'modules'}, | ||
install_requires=[req for req in requirements], | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires='>=3.6', | ||
) |