-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
54 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,38 @@ | ||
# Chatbot | ||
# Chatbot cum Voice Assistant | ||
This a chatbot cum voice assistant that can be used for different purposes. It can do the following tasks: | ||
1. Normal conversation through voice. | ||
2. Get your all events or particular ones from your google calender. | ||
3. Make a google search of your query and open up the browser with the results. | ||
4. Make notes to write down something using notepad. | ||
|
||
WORKING: | ||
## Screenshots | ||
 | ||
|
||
## Installation | ||
* All the modules which are required for this application are stated in requirements.txt file. | ||
To install all of them rum the following command: | ||
``` | ||
pip3 install -r requirements.txt | ||
``` | ||
|
||
* Enable Google Calender API with your account here: https://developers.google.com/calendar/quickstart/python?authuser=3 | ||
* Get a weather api key by creating your account on https://openweathermap.org/api | ||
* Create a keys.py file and add the following: | ||
* EMAIL = "your email id to send emails from" | ||
* PASSWORD = "pasword of your email id" | ||
* DICT = "A dictionary to store the emails of recipients" | ||
* WEATHER_KEY = "your weather api key" | ||
|
||
## Working | ||
The working of the assistant is pretty simple. | ||
First, a simple GUI shows up, in which you can see all your ongoing conversation. | ||
When we click on the speak icon, it detects the voice and converts it to text using | ||
speech_recognition module. | ||
On the text, first NLP is applied that creates a bag of words model which is then passed to a pretrained neural network made using the tflearn module. This network returns the "tag" with whichthe sentence is associated(see intents.json). | ||
On the text, first NLP is applied that creates a bag of words model which is then passed to a pre trained neural network made using the tflearn module. This network returns the "tag" with which | ||
the sentence is associated(see intents.json). | ||
This "tag" is then used to find the "sub tag" with which the sentence is associated | ||
again with the help of the same model. | ||
Once, the subtags is determined, it returns the appropriate answer associated with that | ||
subtag, and the pyttsx3 module is used to speak the answer. | ||
All the features like extracting the events from Google Calender have been defined | ||
inside the calender.py file and the NLP has been applied in prepare.py | ||
For the working with Google Calender you first need to get an API_KEY from Google developers page. | ||
Once, the subtag is determined, it returns the appropriate answer associated with that | ||
subtag, and the pyttsx3 module is used to convey the answer through voice. | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import numpy as np | ||
import json | ||
import random | ||
from model import create_model | ||
import random | ||
import tensorflow as tf | ||
|
@@ -11,17 +10,13 @@ | |
import subprocess | ||
import datetime | ||
import tkinter as tk | ||
from tkinter import Text | ||
import os | ||
import webbrowser as wb | ||
import threading | ||
import time | ||
import weather | ||
import wikipedia | ||
import webbrowser | ||
import smtplib | ||
import keys | ||
from PIL import Image, ImageTk | ||
|
||
try: | ||
from googlesearch import search | ||
|
@@ -172,15 +167,13 @@ def wish(): | |
speak("I am Boss sir, How can I help you") | ||
|
||
|
||
dict = {"Madhur": "[email protected]", "Rishabh": "[email protected]", | ||
"Shivam": "[email protected]"} | ||
|
||
|
||
def send_mails(to, body): | ||
server = smtplib.SMTP('smtp.gmail.com', 587) | ||
server.ehlo() | ||
server.starttls() | ||
server.login('[email protected]', keys.gmail_password()) | ||
server.login(keys.EMAIL, keys.PASSWORD) | ||
server.sendmail('[email protected]', to, body) | ||
server.close() | ||
|
||
|
@@ -209,7 +202,7 @@ def main(): | |
to = get_audio() | ||
speak("what should I say to " + to) | ||
body = get_audio() | ||
send_mails(dict[to], body) | ||
send_mails(keys.DICT[to], body) | ||
speak("Your mail has been sent successfully !") | ||
msg_list.insert(tk.END, "Boss: Your mail has been sent successfully !") | ||
except Exception as e: | ||
|
@@ -225,14 +218,14 @@ def main(): | |
speak(results) | ||
msg_list.insert(tk.END, "Boss: " + str(results)) | ||
elif sub_tag_word == "music-open": | ||
path = "C:\\Users\\hp\\AppData\\Roaming\\Spotify\\Spotify.exe" | ||
path = keys.PATH_MUSIC | ||
ans = answers_dict.get(sub_tag_word) | ||
a = random.choice(ans) | ||
speak(a) | ||
os.startfile(path) | ||
msg_list.insert(tk.END, "Boss: opened Spotify") | ||
elif sub_tag_word == "visual-studio-code-open": | ||
path = "C:\\Users\\hp\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" | ||
path = keys.PATH_VS_CODE | ||
ans = answers_dict.get(sub_tag_word) | ||
a = random.choice(ans) | ||
speak(a) | ||
|
@@ -287,7 +280,7 @@ def run(): | |
main_thread.start() | ||
|
||
|
||
picture = tk.PhotoImage(file=r"C:\Users\hp\Desktop\Chatbot-cum-voice-Assistant\images\voice4.png") | ||
picture = tk.PhotoImage(file=keys.PATH_IMAGE) | ||
send_button = tk.Button(root, image=picture, command=run, borderwidth=0) | ||
send_button.pack() | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
google==2.0.3 | ||
google-api-core==1.16.0 | ||
google-api-python-client==1.8.0 | ||
google-auth==1.11.2 | ||
google-auth-httplib2==0.0.3 | ||
google-auth-oauthlib==0.4.1 | ||
google-pasta==0.1.8 | ||
google-search-results==1.7.1 | ||
googleapis-common-protos==1.51.0 | ||
grpcio==1.27.2 | ||
gTTS==2.1.1 | ||
gTTS-token==1.1.3 | ||
Keras==2.3.1 | ||
Keras-Applications==1.0.8 | ||
Keras-Preprocessing==1.1.0 | ||
openpyxl==3.0.3 | ||
pickleshare==0.7.5 | ||
Pillow==6.2.0 | ||
pyttsx3==2.87 | ||
pytz==2017.3 | ||
SpeechRecognition==3.8.1 | ||
tensorboard==2.1.0 | ||
tensorflow==1.14.0 | ||
tensorflow-estimator==2.1.0 |
This file contains 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