
"""simple docstring"""



import qiskit
def    _UpperCAmelCase (					__lowerCamelCase  :			int					,   __lowerCamelCase  :			int						)	->   qiskit.result.counts.Counts:
  _snake_case   	=			qiskit.Aer.get_backend('''aer_simulator'''						)

  _snake_case   	=			qiskit.QuantumCircuit(4					,   2						)
  # encode inputs in qubits 0 and 1
  if bita == 1:
    qc_ha.x(0						)
  if bita == 1:
    qc_ha.x(1						)
  qc_ha.barrier()

  # use cnots to write XOR of the inputs on qubit2
  qc_ha.cx(0					,   2						)
  qc_ha.cx(1					,   2						)

  # use ccx / toffoli gate to write AND of the inputs on qubit3
  qc_ha.ccx(0					,   1					,   3						)
  qc_ha.barrier()

  # extract outputs
  qc_ha.measure(2					,   0						)  # extract XOR value
  qc_ha.measure(3					,   1						)  # extract AND value

  # Execute the circuit on the qasm simulator
  _snake_case   	=			qiskit.execute(__lowerCamelCase					,   __lowerCamelCase					,   shots=10_00						)

  # Return the histogram data of the results of the experiment
  return job.result().get_counts(__lowerCamelCase						)


if __name__ == "__main__":
 UpperCAmelCase__        =					half_adder(1, 1)
 print(F"Half Adder Output Qubit Counts: {counts}")










'''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	(       __magic_name__					):






       """simple docstring"""
       _snake_case      :	str									=       'Salesforce/blip-image-captioning-base'
       _snake_case      :	Union[str, 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.'
       )
       _snake_case      :	List[Any]									=       'image_captioner'
       _snake_case      :	Union[str, Any]									=       AutoModelForVisionaSeq

       _snake_case      :	Dict									=       ['image']
       _snake_case      :	Optional[int]									=       ['text']





       def __init__(				self  :						Union[str, Any]			,					*lowerCAmelCase__  :						Optional[Any]			,					**lowerCAmelCase__  :						Optional[int]	)       ->	Tuple:

            '''simple docstring'''




            requires_backends(self			,					['''vision''']	)
            super().__init__(*lowerCAmelCase__			,					**lowerCAmelCase__	)





       def snake_case__		(				self  :						Tuple			,					lowerCAmelCase__  :						"Image"	)       ->	Optional[int]:

            '''simple docstring'''




            return self.pre_processor(images=lowerCAmelCase__			,					return_tensors='''pt'''	)





       def snake_case__		(				self  :						Any			,					lowerCAmelCase__  :						Union[str, Any]	)       ->	Union[str, Any]:

            '''simple docstring'''




            return self.model.generate(**lowerCAmelCase__	)







       def snake_case__		(				self  :						int			,					lowerCAmelCase__  :						List[str]	)       ->	List[str]:

            '''simple docstring'''




            return self.pre_processor.batch_decode(lowerCAmelCase__			,					skip_special_tokens=lowerCAmelCase__	)[0].strip()



