Skip to content

Commit

Permalink
update python-api.yml (#1)
Browse files Browse the repository at this point in the history
* update python-api.yml
* update requirements.txt
* add model.pkl
  • Loading branch information
AuHoh committed Jul 4, 2023
1 parent 3226d4f commit 155c3f9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
if [ -f api/requirements.txt ]; then pip install -r api/requirements.txt; fi
- name: Test API with unit test
run: |
python -m unittest discover -s api -t api/tests
export PYTHONPATH=api MODEL_PATH=api/tests/model.pkl && python -m unittest discover -s api/tests -t api
3 changes: 2 additions & 1 deletion api/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import pickle
import os
from smart_open import open

import pandas as pd
Expand All @@ -8,7 +9,7 @@
from sample_call import test_dict

th_proba = 0.54
model_path = '/Users/audreyhohmann/Documents/Formation/OCR/P7/mlruns/274439274391636157/99fce0a77f4045eda1e8cb7e14c57ab7/artifacts/model/model.pkl'
model_path = os.getenv('MODEL_PATH', 'tests/model.pkl')
with open(model_path, 'rb') as file:
model = pickle.load(file)

Expand Down
5 changes: 4 additions & 1 deletion api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
fastapi==0.99.1
pandas==1.5.3
pandas==1.5.3
httpx==0.24.1
smart-open==6.3.0
lightgbm==3.3.5
Binary file added api/tests/model.pkl
Binary file not shown.

0 comments on commit 155c3f9

Please sign in to comment.