-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (46 loc) · 1.59 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Define the name of your project
PROJECT_NAME = hf-serve
# Define the virtual environment name
VENV_NAME = $(PROJECT_NAME)-venv
# Define phony targets
.PHONY: help
help:
@echo "Makefile for $(PROJECT_NAME)"
@echo ""
@echo "Available commands:"
@echo " help Display this help message"
@echo " install Install dependencies"
@echo " test Run tests"
@echo " clean Remove build and cache files"
@echo ""
.PHONY: install
install:
poetry install
.PHONY: test
test:
poetry run pytest
.PHONY: clean
clean:
poetry run rm -rf build dist *.egg-info
find . -name __pycache__ -type d -exec poetry run rm -rf {} +
find . -name '*.pyc' -exec poetry run rm -f {} +
find . -name '*.pyo' -exec poetry run rm -f {} +
.PHONY: venv
venv:
poetry env use $(shell poetry env info --path)
# Define default target
.DEFAULT_GOAL := help
.PHONY: run service with default profile
run:
poetry run uvicorn hf_serve.main:app
.PHONY: use curl to test the feature extraction service
run-feature-extraction:
HF_SERVE_TASK=feature-extraction poetry run uvicorn hf_serve.main:app
.PHONY: use curl to test the text classification service
text-classification:
curl -X POST http://localhost:8000 -H 'accept: application/json' -H 'Content-Type: application/json' -d '{"data": "Je deteste la reforme des retraites"}'
batch-text-classification:
seq 100 | xargs -I{} curl -X POST http://localhost:8000 -H 'accept: application/json' -H 'Content-Type: application/json' -d '{"data": "Je deteste la reforme des retraites"}'
fmt:
poetry run black hf_serve tests benchmark
poetry run isort hf_serve tests benchmark