- Speech Recognition: Utilizes the
Voskmodel for accurate speech recognition, enabling seamless interaction through voice commands. - Intent Classification: Employs a
three-layer linearmodel withReLU activationfunctions to classify user intents effectively. - Basic Task Automation: Capable of performing various basic tasks, such as creating, renaming, and deleting folders, searching the web, managing device controls, and more.
- Expandability: Can be easily expanded to accommodate additional functionalities based on specific user needs.
To use the Virtual Assistant:
-
Download Speech Recongition Model: Extract the compressed
.rarfile insidemodelnamed directory. -
Install Dependencies:
pip install -r requirements.txt
-
Run
train.pyforIntent Classification:py .\neuralnet\train.py -e <EPOCHS> -b <BATCH_SIZE> -p <PLOT:1>
Argument Short Option Type Default Help --batch_size -b int 8 Batch size for training --epochs -e int 250 Number of epochs for training --plot -p int 0 Whether to plot the loss curve (1 for yes, 0 for no) The
intent.pthwill be saved undermodeldirectory after executingtrain.py. -
Set API Keys:
Create a
.envfile in the main directory of the project. Inside the.envfile, define the variable for your API keyBelow is a list of websites and APIs used in this project. Click on the links to access their documentation and obtain the necessary information.
-
Make sure to review the documentation for each API to understand their usage and any specific requirements, such as obtaining API keys or authentication tokens.
WEATHER_API_KEY = "{{secret.YOUR_API_KEY}}" -
-
Run Script:
py chat.py
-
Interaction:
You: hello ByteBot: Hi there, how can I assist you today? You: tell me a joke ByteBot: A perfectionist walked into a bar...apparently, the bar wasn't set high enough You: -
If you want to customize the intent according to your needs, add the
tags,patternsandresponsesinsideintents.jsonin following format and re-runtrain.pywhile adding functionality features inchat.py. Theintent.jsonshould follow this base format:{ "intents": [ { "tag": "greeting", "patterns": [ "Hi there", "Hello", "yo" ], "responses": [ "Hello", "Good to see you again", "Hi there, how can I help?" ], } ] }
If the speech recognition model shows errors, run this script on the same directory path
from engine import initialize_model, speech_recognize
# Transcript
transcript = ''
if __name__ == "__main__":
recognizer, mic, stream = initialize_model()
while True:
data=stream.read(4096)
if recognizer.AcceptWaveform(data):
result = recognizer.Result()[14:-3]
transcript += result + ' '
print(transcript)The current version of the Virtual Assistant may have limitations in complex tasks or specialized domains. You can add more functions or integrate Language Models like Llama2, MistralAI, BERT.
Feel free to customize and extend the Virtual Assistant to suit your specific needs and requirements. Contributions and feedback are welcome!
