<jupyter_start><jupyter_text><jupyter_code>!pip install --upgrade azure-cognitiveservices-vision-computervision -q #instalar paquete de Microsoft con los servicios cognitivos
from azure.cognitiveservices.vision.computervision import ComputerVisionClient # Funcionalidades para conectarnos con nuestro recurso de Cognitive Services
# y validar nuestro acceso.
from msrest.authentication import CognitiveServicesCredentials

big_ben = "https://upload.wikimedia.org/wikipedia/commons/9/93/Clock_Tower_-_Palace_of_Westminster%2C_London_-_May_2007.jpg" #jalar la imagen
key = "" #autenticacion
endpoint = ""
client = ComputerVisionClient(endpoint,CognitiveServicesCredentials(key)) #consumir el servicio de computer vision

describe = client.describe_image(big_ben)

dir(describe) #The dir() function returns all properties and methods of the specified object, without the values.

# This function will return all the properties and methods, even built-in properties which are default for all object.

describe.tags #describe lo que hay dentro de la funcion
dir(describe.captions) 
for caption in describe.captions: #imprime los captions dentro del objeto 
  print(caption.text,caption.confidence)
detect = client.detect_objects(big_ben)
for obj in detect.objects:
  print(obj.object_property,obj.rectangle)
landmarks = client.analyze_image_by_domain("landmarks",big_ben)
landmarks.result
analyze = client.analyze_image(big_ben)
dir(analyze)
for category in analyze.categories:
  print(category)<jupyter_output>{'additional_properties': {}, 'name': 'building_', 'score': 0.76953125, 'detail': None}
{'fraction_non_alphanumeric': 0.08338518979464841, 'fraction_numerical': 0.010578718108276292, 'mean_word_length': 6.549295774647887, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '428725', 'license': 'MIT', 'n_tokens_mistral': 504, 'n_tokens_neox': 471, 'n_words': 131, 'path': 'Visioncomputarizada.ipynb', 'repo_name': 'AnneliesseMorales/ms-learn-ml-crash-course-python', 'size': '1607'}