A newer version of the Gradio SDK is available:
5.9.1
title: Lamassu
emoji: 🤗
colorFrom: gray
colorTo: red
sdk: gradio
sdk_version: 5.1.0
app_file: app.py
pinned: false
license: apache-2.0
Lamassu is a Named Entity Extraction service that is capable of running on Hugging Face and MLflow managed environment. It is the service backing the Nexus Graph
Hugging Face
Lamassu is directly available on Hugging Face space. Please check it out.
MLflow
Getting Source Code
git clone [email protected]:QubitPi/lamassu.git
Running Locally
Create virtual environment and install dependencies:
cd lamassu/mlflow
python3 -m venv .venv
. .venv/bin/activate
pip3 install -r requirements.txt
Generate Model with
python3 HanLPner.py
A model directory called "HanLPner" appears under mlflow/models
. Then build Docker image
mlflow models build-docker --name "entity-extraction"
and run container with
cp parser.py models/HanLPner/
export ML_MODEL_PATH=/absolute/path/to/models/HanLPner
docker run --rm \
--memory=4000m \
-p 8080:8080 \
-v $ML_MODEL_PATH:/opt/ml/model \
-e PYTHONPATH="/opt/ml/model:$PYTHONPATH" \
-e GUNICORN_CMD_ARGS="--timeout 60 -k gevent" \
"entity-extraction"
If
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
error is seen, refer to https://forums.docker.com/t/docker-errors-dockerexception-error-while-fetching-server-api-version-connection-aborted-filenotfounderror-2-no-such-file-or-directory-error-in-python/135637/5
The container runs Gunicorn server inside to serve incoming requests.
Example query:
curl -X POST -H "Content-Type:application/json" \
--data '{"dataframe_split": {"columns":["text"], "data":[["我爱中国"], ["世界会变、科技会变,但「派昂」不会变,它不会向任何人低头,不会向任何困难低头,甚至不会向「时代」低头。「派昂」,永远引领对科技的热爱。只有那些不向梦想道路上的阻挠认输的人,才配得上与我们一起追逐梦想"]]}}' \
http://127.0.0.1:8080/invocations
Note the JSON schema of the --data
value
License
The use and distribution terms for lamassu are covered by the Apache License, Version 2.0.