COMET models are trained to predict quality scores for translations. This is a mock version which provides random scores.
Clone this repository:
gh repo clone capstanlqc/comet-api-mock
Create a virtual environment and activate it:
cd /path/to/comet-api-mock
python -m venv venv && source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Copy .env.example
to .env
:
cp .env-example .env
Update the environment variables you need to use in .env
(none in the mock version).
Run the API (for testing and development):
fastapi dev code/main.py
The mandatory model
parameter accepts values such as provider/model
. The optional mode
parameter accepts either mock
(default value, if missing) or any other value (e.g. dev
or prod
, not yet defined).
The following call will get mock random scores (same as without mode
parameter):
curl --location --request GET 'http://127.0.0.1:8000/api/scores?model=Unbabel/wmt22-cometkiwi-da&mode=mock' \
--header 'Content-Type: application/json' \
--data '[
{"src": "How to Demonstrate Your Strategic Thinking Skills", "mt": "Cómo demostrar su capacidad de pensamiento estratégico" },{ "src": "Why is Accuracy important in the workplace?", "mt": "¿Por qué es importante la precisión en el trabajo" }, { "src": "When faced with a large amount of analysis ask for support setting up a team to approach the issue in different ways.", "mt": "Cuando se enfrente a una gran cantidad de análisis, pida ayuda para crear un equipo que aborde la cuestión de diferentes maneras." }
]'