


'''simple docstring'''

import os





def lowerCamelCase      (      ):





	"""simple docstring"""







	__magic_name__	:   Tuple					     =					os.path.dirname(os.path.realpath(lowerCAmelCase		)		)
	__magic_name__	:   Any					     =					os.path.join(lowerCAmelCase		,		'triangle.txt'		)

	with open(lowerCAmelCase		) as f:
		__magic_name__	:   Optional[int]					     =					f.readlines()

	__magic_name__	:   Any					     =					[]
	for line in triangle:
		__magic_name__	:   List[Any]					     =					[]
		for number in line.strip().split(' '		):
			numbers_from_line.append(int(lowerCAmelCase		)		)
		a.append(lowerCAmelCase		)

	for i in range(1		,		len(lowerCAmelCase		)		):
		for j in range(len(a[i]		)		):
			__magic_name__	:   Dict					     =					a[i - 1][j] if j != len(a[i - 1]		) else 0
			__magic_name__	:   int					     =					a[i - 1][j - 1] if j > 0 else 0
			a[i][j] += max(lowerCAmelCase		,		lowerCAmelCase		)
	return max(a[-1]		)


if __name__ == "__main__":
							print(solution())



'''simple docstring'''

# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

from ..models.auto import AutoModelForVisionaSeq
from ..utils import requires_backends
from .base import PipelineTool


if TYPE_CHECKING:
							from PIL import Image
class _lowerCamelCase	(						lowercase__							):



		'''simple docstring'''







		A_     :      Any				   =    """Salesforce/blip-image-captioning-base"""
		A_     :      Any				   =    (
		    """This is a tool that generates a description of an image. It takes an input named `image` which should be the """
		    """image to caption, and returns a text that contains the description in English."""
		)
		A_     :      List[str]				   =    """image_captioner"""
		A_     :      Optional[Any]				   =    AutoModelForVisionaSeq

		A_     :      Any				   =    ["""image"""]
		A_     :      Union[str, Any]				   =    ["""text"""]







		def __init__( self		:						Dict  ,					*_A		:						Dict  ,					**_A		:						Any      )  ->			Dict:
			requires_backends(self  ,					['vision']      )
			super().__init__(*_A  ,					**_A      )







		def        __lowerCAmelCase		( self		:						Tuple  ,					_A		:						"Image"      )  ->			Union[str, Any]:
			return self.pre_processor(images=_A  ,					return_tensors='pt'      )







		def        __lowerCAmelCase		( self		:						Optional[Any]  ,					_A		:						str      )  ->			List[Any]:
			return self.model.generate(**_A      )







		def        __lowerCAmelCase		( self		:						int  ,					_A		:						Optional[int]      )  ->			Union[str, Any]:
			return self.pre_processor.batch_decode(_A  ,					skip_special_tokens=_A      )[0].strip()