import numpy as np

from transformers import Pipeline



def 						a_		(      lowerCamelCase ):
				UpperCAmelCase__    =							np.max(__lowercase      ,    axis=-1      ,    keepdims=__lowercase )
				UpperCAmelCase__    =							np.exp(outputs - maxes )
				return shifted_exp / shifted_exp.sum(axis=-1      ,    keepdims=__lowercase )







class        snake_case (				__A       ):




					"""simple docstring"""

					def 	__lowerCAmelCase		(       self     :			List[Any]					,**lowerCamelCase__     :			Tuple    ):
									UpperCAmelCase__    =							{}
									if "second_text" in kwargs:
													UpperCAmelCase__    =							kwargs['second_text']
									return preprocess_kwargs, {}, {}







					def 	__lowerCAmelCase		(       self     :			List[Any]					,lowerCamelCase__     :			Tuple					,lowerCamelCase__     :			Any=None    ):
									return self.tokenizer(lowerCamelCase__					,text_pair=lowerCamelCase__					,return_tensors=self.framework    )







					def 	__lowerCAmelCase		(       self     :			Dict					,lowerCamelCase__     :			List[Any]    ):
									return self.model(**lowerCamelCase__    )







					def 	__lowerCAmelCase		(       self     :			Any					,lowerCamelCase__     :			int    ):
									UpperCAmelCase__    =							model_outputs.logits[0].numpy()
									UpperCAmelCase__    =							softmax(lowerCamelCase__    )

									UpperCAmelCase__    =							np.argmax(lowerCamelCase__    )
									UpperCAmelCase__    =							self.model.config.idalabel[best_class]
									UpperCAmelCase__    =							probabilities[best_class].item()
									UpperCAmelCase__    =							logits.tolist()
									return {"label": label, "score": score, "logits": logits}




"""simple docstring"""






import socket



def 						a_		(      ):
				UpperCAmelCase__    =							socket.socket(socket.AF_INET      ,    socket.SOCK_STREAM )
				UpperCAmelCase__    =							socket.gethostname()
				UpperCAmelCase__    =							1_2_3_1_2

				sock.connect((host, port) )
				sock.send(b'Hello server!' )

				with open('Received_file'      ,    'wb' ) as out_file:
								print('File opened' )
								print('Receiving data...' )
								while True:
												UpperCAmelCase__    =							sock.recv(1_0_2_4 )
												if not data:
																break
												out_file.write(lowerCamelCase )

				print('Successfully received the file' )
				sock.close()
				print('Connection closed' )


if __name__ == "__main__":
						main()



