MirAI is an intelligent connected mirror that enhances daily life through voice interactions, real-time information, and smart home integration. Using Azure Cognitive Services and OpenAI, MirAI provides a seamless user experience with natural language processing, weather updates, calendar synchronization, and much more.
My Role
Implemented voice recognition and speech synthesis using Azure Speech Services.
Integrated OpenAI for intelligent conversation handling.
Designed and built real-time weather synchronization.
Developed a voice-activated user interface for smooth interaction.
Tools & Technologies
✅ Azure Cognitive Services (Speech-to-Text, Text-to-Speech) ✅ OpenAI API (Chat-based interactions) ✅ Python (Core development language) ✅ SimpleAudio (Audio feedback system) ✅ Requests (Fetching weather data from OpenWeather API) ✅ Dotenv (Managing environment variables)
Code Highlights
Speech Recognition with Azure Speech Services
speech_recognition.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import azure.cognitiveservices.speech as speechsdk
print("Listening...") result = speech_recognizer.recognize_once()
return result.text if result.reason == speechsdk.ResultReason.RecognizedSpeech else"Speech not recognized."
OpenAI Chat Integration
openai_integration.py
1 2 3 4 5 6 7 8 9 10 11 12 13
import openai
openai.api_key = "YOUR_OPENAI_KEY"
defcomplete_openai(name, prompt, token=100): response = openai.completions.create( model="gpt-3.5-turbo-instruct", prompt=f"You are MirAI, a smart mirror assistant. Address the user by name: {name}. Here is the input: {prompt}", temperature=0.7, max_tokens=token ) return response.choices[0].text.strip()
user_input_lower = user_input.lower() if'current temperature'in user_input_lower: prompt = f"Based on this input: '{user_input}', extract only the city name, without quotes or formatting." city_result = complete_openai(name, prompt=prompt, token=3000)
prompt = f"Based on this weather data: {get_weather_forecast(city_result)}, generate a short assistant-like response." result = complete_openai(name, prompt=prompt, token=3000)
else: result = complete_openai(name, prompt=user_input, token=3000)