Azure Cognitive Services Intermediate
Azure Cognitive Services (now Azure AI Services) provides pre-built AI models accessible through simple REST APIs and SDKs. Add vision, speech, language, and decision-making capabilities to your applications without building ML models from scratch.
Vision Services
Computer Vision
Analyze images for content, objects, text (OCR), faces, and spatial analysis:
from azure.cognitiveservices.vision.computervision import ComputerVisionClient from msrest.authentication import CognitiveServicesCredentials client = ComputerVisionClient( endpoint="https://my-vision.cognitiveservices.azure.com/", credentials=CognitiveServicesCredentials("YOUR_API_KEY") ) # Analyze an image analysis = client.analyze_image( url="https://example.com/photo.jpg", visual_features=["Categories", "Description", "Objects", "Tags"] ) print(f"Description: {analysis.description.captions[0].text}") for tag in analysis.tags: print(f"Tag: {tag.name} ({tag.confidence:.2f})")
Speech Services
Speech-to-Text
import azure.cognitiveservices.speech as speechsdk speech_config = speechsdk.SpeechConfig( subscription="YOUR_API_KEY", region="eastus" ) speech_config.speech_recognition_language = "en-US" # Recognize from microphone recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config) result = recognizer.recognize_once() if result.reason == speechsdk.ResultReason.RecognizedSpeech: print(f"Recognized: {result.text}")
Text-to-Speech
# Synthesize speech synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config) result = synthesizer.speak_text_async("Hello from Azure AI Services!").get() if result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted: print("Speech synthesized successfully!")
Language Services
Text Analytics
from azure.ai.textanalytics import TextAnalyticsClient from azure.core.credentials import AzureKeyCredential client = TextAnalyticsClient( endpoint="https://my-language.cognitiveservices.azure.com/", credential=AzureKeyCredential("YOUR_API_KEY") ) documents = ["Azure AI is an amazing platform for building intelligent apps."] # Sentiment analysis response = client.analyze_sentiment(documents=documents) for doc in response: print(f"Sentiment: {doc.sentiment}, Scores: {doc.confidence_scores}") # Entity recognition response = client.recognize_entities(documents=documents) for doc in response: for entity in doc.entities: print(f"Entity: {entity.text} ({entity.category})")
Decision Services
| Service | Description | Use Case |
|---|---|---|
| Anomaly Detector | Detect anomalies in time series data | Monitoring, fraud detection, IoT |
| Content Safety | Detect harmful content in text and images | Content moderation, user safety |
| Personalizer | Deliver personalized experiences using reinforcement learning | Content recommendations, UI optimization |
AI Capabilities Added!
You can now integrate pre-built AI into any application. In the final lesson, explore best practices for enterprise Azure AI deployments.
Next: Best Practices →Ready to Go Deeper?
Live instructor-led courses from our partners. Affiliate disclosure.
AI & ML Courses - 30% Off
Live instructor-led AI, machine learning, data science, and cloud courses for working professionals. Use code Limited30 at checkout.
EdurekaDataCamp - AI & Data Science
Hands-on Python, machine learning, and AI courses with interactive exercises and real projects.
DataCampedX - Top AI Courses
University-level AI courses from MIT, Harvard, Stanford. Earn certificates that employers recognize.
edX