1- import bentoml , getpass , os , pandas as pd , tarfile , tempfile , uuid
1+ import bentoml
2+ import getpass
3+ import os
4+ import pandas as pd
5+ import tarfile
6+ import tempfile
7+ import uuid
28
39from bentoml .saved_bundle .bundler import _write_bento_content_to_dir
410from bentoml .utils .tempdir import TempDirectory
@@ -15,7 +21,6 @@ def __init__(self, email: str = None, password: str = None):
1521 self .flask_api = FlaskAPI ()
1622 self .firebase_api = FirebaseAPI (email = email , password = password )
1723
18-
1924 def add_model (self , function , model ):
2025 bento_service = create_template_model ('sklearn' , 'text' )
2126 bento_service .pack ('model' , model )
@@ -31,10 +36,9 @@ def add_model(self, function, model):
3136 with tarfile .open (tarfile_path , mode = 'w:gz' ) as tar :
3237 tar .add (temp_dir , arcname = bento_service .name )
3338
34- user_id = self .firebase_api .user ['localId' ]
35- remote_path = f'users/{ user_id } /models/{ model_id } '
36- self .firebase_api .upload (remote_path , tarfile_path )
37-
39+ user_id = self .firebase_api .user ['localId' ]
40+ remote_path = f'users/{ user_id } /models/{ model_id } '
41+ self .firebase_api .upload (remote_path , tarfile_path )
3842
3943 def add_dataset (self , file_path : str , name : str ):
4044 # For now, let's upload straight to Firebase Storage from here
@@ -51,7 +55,6 @@ def add_dataset(self, file_path: str, name: str):
5155 id_token )
5256 return response .json ()
5357
54-
5558 def add_dataframe (self , df : pd .DataFrame , name : str ):
5659 with tempfile .TemporaryDirectory () as tmp_dir :
5760 dataset_file_path = os .path .join (tmp_dir , str (uuid .uuid1 ()))
0 commit comments