Skip to content

Commit d5ea98a

Browse files
Update changelog, remove requirements.txt inference logic from models.py, pip install unboxapi for fetal health examples
1 parent 6e34858 commit d5ea98a

File tree

4 files changed

+32
-13
lines changed

4 files changed

+32
-13
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10-
### Fixed
10+
# Changed
11+
12+
* `requirements_txt_file` no longer optional for model uploads.
13+
14+
# Fixed
1115

1216
* Added protobuf==3.2.0 to requirements to fix bug with model deployment.
1317

examples/tabular-classification/sklearn/fetal-health/fetal-health-sklearn.ipynb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,22 @@
611611
"source": [
612612
"## Unbox part!\n",
613613
"\n",
614+
"### pip installing unboxapi"
615+
]
616+
},
617+
{
618+
"cell_type": "code",
619+
"execution_count": null,
620+
"metadata": {},
621+
"outputs": [],
622+
"source": [
623+
"!pip install unboxapi"
624+
]
625+
},
626+
{
627+
"cell_type": "markdown",
628+
"metadata": {},
629+
"source": [
614630
"### Instantiating the client"
615631
]
616632
},

unboxapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def add_model(
208208
model,
209209
model_type: ModelType,
210210
class_names: List[str],
211-
requirements_txt_file: str = None,
211+
requirements_txt_file: str,
212212
feature_names: List[str] = [],
213213
categorical_feature_names: List[str] = [],
214214
train_sample_df: pd.DataFrame = None,

unboxapi/models.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,19 @@ def _format_custom_code(custom_model_code: Optional[str]) -> str:
113113

114114

115115
def _env_dependencies(
116-
tmp_dir: str, requirements_txt_file: Optional[str], setup_script: Optional[str]
116+
tmp_dir: str, requirements_txt_file: str, setup_script: Optional[str]
117117
):
118118
unbox_req_file = f"{tmp_dir}/requirements.txt"
119119
env_wrapper_str = ""
120-
if not requirements_txt_file:
121-
env_wrapper_str += "@env(infer_pip_packages=True"
122-
else:
123-
shutil.copy(requirements_txt_file, unbox_req_file)
124-
# Add required dependencies
125-
deps = [f"bentoml=={bentoml.__version__}", "pandas"]
126-
with open(unbox_req_file, "a") as f:
127-
f.write("\n")
128-
[f.write(f"{dep}\n") for dep in deps]
129-
env_wrapper_str += f"@env(requirements_txt_file='{unbox_req_file}'"
120+
121+
shutil.copy(requirements_txt_file, unbox_req_file)
122+
# Add required dependencies
123+
deps = [f"bentoml=={bentoml.__version__}", "pandas"]
124+
with open(unbox_req_file, "a") as f:
125+
f.write("\n")
126+
[f.write(f"{dep}\n") for dep in deps]
127+
128+
env_wrapper_str += f"@env(requirements_txt_file='{unbox_req_file}'"
130129

131130
# Add a user defined setup script to execute on startup
132131
if setup_script:

0 commit comments

Comments
 (0)