This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import collections | |
| import json | |
| import typing | |
| class RecognitionCancelledError(Exception): | |
| ... | |
| ConditionalHandler = collections.namedtuple('ConditionalHandler', 'condition handler') | |
| class Recognizer: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data = ... | |
| recognizer = Recognizer(...) | |
| for event in recognizer.recognize(): | |
| if event.type == 'speakerRecognized': | |
| ... | |
| elif event.type == 'done': | |
| ... | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import carbon | |
| video_stream = ... | |
| # Module level function lets you pick a stream, "features" and go | |
| # (this assumes there is a default configuration for each feature/category/model) | |
| for event in carbon.recognize(video_stream, features=['faceDetection', 'vehicleDetection']): | |
| print(event) | |
| # Slightly more involved scenario with custom configurations and a dedicated session... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AiEventMeta(type): | |
| def __init__(cls, name, bases, nmspc): | |
| super().__init__(name, bases, nmspc) | |
| if not hasattr(cls, 'event_type_registry'): | |
| setattr(cls, 'event_type_registry', {}) | |
| if hasattr(cls, 'EVENT_TYPE_NAME'): | |
| cls.event_type_registry[cls.EVENT_TYPE_NAME] = cls | |
| class AiEvent(metaclass=AiEventMeta): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "swagger": "2.0", | |
| "info": { | |
| "title": "Example service", | |
| "version": "1.1" | |
| }, | |
| "paths": { | |
| "/ComputeNodes": { | |
| "parameters": [ | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "swagger": "2.0", | |
| "info": { | |
| "title": "Example of polymorphic models, hypothetical document recognition style", | |
| "version": "1.0" | |
| }, | |
| "consumes": ["application/json"], | |
| "produces": ["application/json"], | |
| "paths": { | |
| "/analyze": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import typing | |
| class InfoFragment(typing.TypedDict): | |
| title: str | |
| version: str | |
| OptionalInAttribute = typing.TypedDict( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "swagger": "2.0", | |
| "info": { | |
| "title": "Show x-ms-paths", | |
| "version": "1.0" | |
| }, | |
| "x-ms-paths": { | |
| /* Note - fake query parameter to make the path unique. Not actually used in the API. | |
| You can also differentiate using a different path parameter name if the path is parameterized | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "swagger": "2.0", | |
| "info": { | |
| "title": "Examples of scenarios - #1, more constrained children", | |
| "version": "1.0" | |
| }, | |
| "paths": [], | |
| "definitions": { | |
| "GenericResource": { | |
| "type": "object", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import typing | |
| import purl | |
| HeadersType = typing.Union[typing.Sequence[typing.Tuple[str, typing.Any]], typing.Mapping[str, typing.Any], None] | |
| JsonBodyType = typing.Union[typing.Mapping[str, "JsonBodyType"], str, int, float, bool, None] | |
| ParamType2 = typing.Union[typing.Sequence[typing.Tuple[str, typing.Any]], typing.Mapping[str, typing.Any]] | |
| ParamType = typing.Union[typing.Sequence[typing.Tuple[str, typing.Any]], typing.Mapping[str, typing.Any]] |