Skip to content

This is repository of a virtual desktop assistant similar to Alexa/Google Assistant (but a more simple one). I will modify the code if I found something more interesting to add!

Notifications You must be signed in to change notification settings

omk4r-codes/Voice-Activated-Virtual-Assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ai-desktop-assistant

Voice-Activated Virtual Assistant

Ong it’s the simplest one!

This Python script creates a voice-activated virtual assistant that can perform various tasks such as opening websites, playing songs, providing the current time, and even generating responses using OpenAI’s GPT-3 language model.

Features

  • Voice Recognition: The assistant uses the SpeechRecognition library to recognize spoken commands.
  • Text-to-Speech: It utilizes the pyttsx3 library to provide spoken responses in a customizable voice.
  • Web and App Control: You can command the assistant to open specific websites or applications.
    *by specific I mean those stored in the nameofsites python file
  • Music & Video Playback: You can instruct the assistant to play songs/videos from a predefined list.
    *Audio/video files should be downloaded on the system. Then add the name and path of the file to be played to the list in namesofsites file.
  • Time Display: Ask the assistant for the current time, and it will respond with the current time.
  • AI-Powered Responses: By saying “using AI” followed by a prompt, the assistant can generate responses using OpenAI’s GPT-3 text generation model.

Prerequisites

Before running the script, ensure you have the following:
  • Python 3 installed on your system.
  • pyAudio should be installed. (install it from https://www.lfd.uci.edu/~gohlke/pythonlibs/)
  • Required Python libraries, including speech_recognition, pyttsx3, webbrowser, os, and openai.
  • Access to an OpenAI API key for generating AI-powered responses.
  • Though you need to pay for openAI’s responses as per the guidlines of the company.

Usage

  1. Run the python file using any compiler.
  2. The assistant will greet you and wait for your voice command.
  3. Speak your command clearly, and the assistant will process it accordingly.
  4. To exit the program, say “no” when asked if you want any other help.
  5. For now the number of commands is limited.
  6. some of the common commands are:
    • “what’s the time now?”
    • “tell me a joke”
    • “open {file/app/website name}”
    • “play {video/audio name}”
    • “using AI, {prompt for openAI}”
  7. “using AI, …” is the most flexible command as it returns the query from openAI servers.
  8. For any audio/video playing, take the another file, i.e., namesofsites and add the name and its address in the “songs_or_videos” list.
  9. For website/app opening, add the name of the website/app and its url/local address in the “sites_or_apps” list.
  10. If the zira_id doesn’t work for you or you want to change the voice, find the compatible voice ID’s in your pc using:
    voices = pyttsx3.init().getProperty('voices')
    for voice in voices:
        print(f"Voice ID: {voice.id}, Name: {voice.name}")
    

Customization

  • You can customize the voice accent used by modifying the zira_id variable.
  • Careful with changing the voice ID; change as mentioned.
  • Add or remove websites and songs in the “sites_or_apps” and “songs_or_videos” lists, respectively, to expand or modify the assistant’s capabilities.

Note

  • Be cautious with your OpenAI API key usage to avoid rate limit errors.
  • Ensure that you have the necessary voices and language packs installed for text-to-speech functionality.

Acknowledgments

  • The project uses the SpeechRecognition, pyttsx3, and OpenAI libraries.
  • Voice responses are generated using OpenAI’s GPT-3.
  • You can take the help of CodeWithHarry’s Video in the initial developement, thanks to him I was able to solve some queries!

Feel free to customize and expand upon this code to create your own voice-activated virtual assistant!

About

This is repository of a virtual desktop assistant similar to Alexa/Google Assistant (but a more simple one). I will modify the code if I found something more interesting to add!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages