original_docstring:  Publish model to Shipped Brain from a logged mlflow model's run id
  
      :param run_id: run id of mlflow logged model
      :param model_name: name of the model to publish on app.shippedbrain.com
      :param email: shipped brain account email
      :param password: shipped brain account password
      :param flavor: flavor of the logged model; must be a valid mlflow flavor
      :param login_url: login url to shipped brain
      :param upload_url: upload_url to shipped brain
  
      :return: model upload requests.Response from app.shippedbrain.com
      
docstring: Publish model to Shipped Brain from a logged mlflow model's run id
docstring_tokens: Publish model to Shipped Brain from a logged mlflow model ' s run id
code: def upload_run(run_id: str,
                 model_name: str,
                 email: Optional[str] = None,
                 password: Optional[str] = None,
                 flavor: str = "pyfunc",
                 login_url: str = LOGIN_URL,
                 upload_url: str = UPLOAD_URL) -> requests.Response:
      """ Publish model to Shipped Brain from a logged mlflow model's run id
  
      :param run_id: run id of mlflow logged model
      :param model_name: name of the model to publish on app.shippedbrain.com
      :param email: shipped brain account email
      :param password: shipped brain account password
      :param flavor: flavor of the logged model; must be a valid mlflow flavor
      :param login_url: login url to shipped brain
      :param upload_url: upload_url to shipped brain
  
      :return: model upload requests.Response from app.shippedbrain.com
      """
  
      client = mlflow.tracking.MlflowClient()
  
      email = email if email else os.getenv("SHIPPED_BRAIN_EMAIL")
      password = password if password else os.getenv("SHIPPED_BRAIN_PASSWORD")
  
      assert email,\
          f"Bad email. Environment variable SHIPPED_BRAIN_EMAIL is not defined or you did not provide the email argument."
      assert password,\
          f"Bad password. Environment variable SHIPPED_BRAIN_PASSWORD is not defined or you did not provide the" \
          f" password argument."
      assert _validate_model_name(model_name), f"Bad model name '{model_name}! Please provide a valid model name"
      assert _validate_run_id(client, run_id), f"The run id '{run_id}' you provided is not valid!"
      assert _validate_model(run_id), f"The model with '{run_id}' is not valid!"
  
      model_artifacts_path = _get_model_artifacts_path(run_id)
      
      model_metrics = _get_run_metrics(client, run_id) 
      model_params = _get_run_params(client, run_id)
  
      with tempfile.TemporaryDirectory() as tmpdir:
          _download_artifacts(client, run_id, tmpdir)
          _create_shipped_brain_yaml(model_name, model_artifacts_path, flavor_name[flavor], tmpdir, metrics=model_metrics, params=model_params)
          zipped_file = _zip_artifacts(tmpdir)
  
          login_response = _login(email, password, login_url)
          assert login_response.status_code == 200, \
              f"Failed to login with status code {login_response.status_code}. Error: {login_response.text}"
          response_data = eval(login_response.text)
  
          auth_bearer = response_data["data"]["results"]["access_token"]
  
          upload_response = _upload_file(zipped_file, auth_bearer, upload_url)
  
          return upload_response
code_tokens: def upload_run ( run_id : str , model_name : str , email : Optional [ str ] = None , password : Optional [ str ] = None , flavor : str = "pyfunc" , login_url : str = LOGIN_URL , upload_url : str = UPLOAD_URL ) -> requests . Response : client = mlflow . tracking . MlflowClient ( ) email = email if email else os . getenv ( "SHIPPED_BRAIN_EMAIL" ) password = password if password else os . getenv ( "SHIPPED_BRAIN_PASSWORD" ) assert email , f"Bad email. Environment variable SHIPPED_BRAIN_EMAIL is not defined or you did not provide the email argument." assert password , f"Bad password. Environment variable SHIPPED_BRAIN_PASSWORD is not defined or you did not provide the" f" password argument." assert _validate_model_name ( model_name ) , f"Bad model name '{model_name}! Please provide a valid model name" assert _validate_run_id ( client , run_id ) , f"The run id '{run_id}' you provided is not valid!" assert _validate_model ( run_id ) , f"The model with '{run_id}' is not valid!" model_artifacts_path = _get_model_artifacts_path ( run_id ) model_metrics = _get_run_metrics ( client , run_id ) model_params = _get_run_params ( client , run_id ) with tempfile . TemporaryDirectory ( ) as tmpdir : _download_artifacts ( client , run_id , tmpdir ) _create_shipped_brain_yaml ( model_name , model_artifacts_path , flavor_name [ flavor ] , tmpdir , metrics = model_metrics , params = model_params ) zipped_file = _zip_artifacts ( tmpdir ) login_response = _login ( email , password , login_url ) assert login_response . status_code == 200 , f"Failed to login with status code {login_response.status_code}. Error: {login_response.text}" response_data = eval ( login_response . text ) auth_bearer = response_data [ "data" ] [ "results" ] [ "access_token" ] upload_response = _upload_file ( zipped_file , auth_bearer , upload_url ) return upload_response
short_docstring: Publish model to Shipped Brain from a logged mlflow model's run id
short_docstring_tokens: Publish model to Shipped Brain from a logged mlflow model ' s run id
comment: """ Publish model to Shipped Brain from a logged mlflow model's run id
  
      :param run_id: run id of mlflow logged model
      :param model_name: name of the model to publish on app.shippedbrain.com
      :param email: shipped brain account email
      :param password: shipped brain account password
      :param flavor: flavor of the logged model; must be a valid mlflow flavor
      :param login_url: login url to shipped brain
      :param upload_url: upload_url to shipped brain
  
      :return: model upload requests.Response from app.shippedbrain.com
      """