Transcripts
1. Course Introduction: Good evening, Tony.
Hello, Tony. I am Jarvis. Please tell me how
may I help you. Who is Donald Trump?
Searching Wikipedia. According to Wikipedia, Donald John Trump
born June 14, 1946, is an American politician,
media personality, and businessman who served as the 45th president of the
United States 2017-2021. What? If we had a Journeys
assistant like Iron Man. But today in this
tutorial series, we are going to learn how can we create our own Jas AI assistant? Hello. My name is
Join the Shorter. Professionally, I'm web
developer and Python programmer. I have been involved with
this for about five years. This is going to be a very
fun and crazy project. Using your voice command, nearly you can control
everything in your computer. You can open any application, you can search browsers. You can search Wikipedia, you can open you to videos, you can send WSP message, e mail, get live news
subject, and Many. So let's take a tour.
What can we do with that? So let's start with
current news updates. Good evening, Tony.
Hello, Tony, I am Jarvis. Please tell me how
may I help you. To news. News headlines. Indonesian
researchers breed good mosquitoes to combat
Dange the Indian Express. The trial results
showed that deploying mosquitoes with Walbeky
reduced Dange cases by as much as 77% and
hospitalizations by up to 86%. Now, I'm going to open websites
using my voice command. Open Google. As you can see, it opened my web browser
and redirect to google.com. Similarly, following
this method, you can open YouTube
also F open YouTube. As you can see, it
redirect youtube.com. You can open any website
using your voice command, like Facebook, ge tub, stack overflow, et cetera. Not only that, we can
search particular queries in search engine.
Search browser. What should I search? Donald Trump. As you can see, after open my browser, it serves the query,
Donald Trump. So you can search
any result from search engine using
voice command. And now I'm going to
ask my IP address from my GRIs assistant,
my IP address. Your IP is 1,279.16 0.58. Let's open some application
using voice command. Open command from.
As you can see, it opened dos Command Prom. But now I want to open
Photoshop using voice command. Jervis, please open Photoshop. As you can see, it's open
my photoshop application. And now I want to
play music from my music directory
using my voice command. Play music. As you can
see, it's play our music. You can play any
particular music. Otherwise, you can
use random function to play any music
from this list. And now I want to play particular video in
YouTube. Play YouTube. What should I search in YouTube? Believer Song. As you can
see, is open my browser. And as you can see, he play
the Believer song in YouTube. And now I want to send
what's the message using my voice command. Send message. Who do you want to
send a message? And then we need to
pass the mobile number. And then I'm going to press.
What do you want to send? Hello, Tony. As you can see, it sent our message. Not only that. We can send
e mail also. Send e mail. What should I send, sir? Hello World. Welcome to my Word. Whom to send the e mail, Ener e mail address, sir. Now, I need to pass
the e mail address. And then I'm going
to press Enter. Here you can see the content. Hello, World.
Welcome to my world. So our Jervis is enough
capable to send e mail anyone. Hey, this is not the end. I'm going to add more and more advanced feature
in this program. Hey, this is quite
powerful. Isn't it? For this project,
we are going to use Python programming language. For this project, you don't
need any special requirement. Just you should
have knowledge of basic Python syntax.
That's enough. This project going to
enhance your Python skills. If you think it quite
beneficial for you, please enroll the schools. Thanks for watching this video.
2. Create Speak Function For Audio Output : Finally, I am in by
Visual Studio cod tor, and I already create a
Python file main dot Pi. At first, I'm going to
create Speak function, which can speak our audio. I'm going to type Dave, speak inside the parentheses
or first argument is audio. Then inside this peak function, for now, I'm going to type pus. In this function,
we are going to provide text as an argument. This function going to convert
this text into a audio. But at first, you need
to install a module, which is Pi T Sex three. Now I'm going to open
my Windows Power shell, and now I'm going to install
Pi T Sex three module. P install Pitt S X three, and then I'm going
to press enter. As you can see, it's written requirement already satisfied, but you need to complete
your download process. Then back to the tor, actually, this module is very important
for audio feedback. Then we need to import
this module in our file. I'm going to type import Pitt, Sex three, and then just follow my step and create a
variable name engine. Engine equal to Pitt Sx
three dot init function. Inside the
parentheses, I'm going to use our inval voice module, which is spi five. This is the inval voice module of Windows operating systems, and we are going to use it
for our audio feedback. Basically, our dos
operating system provide two type of voice. Let me show you. So to create
a variable name voices. Voice is equal to engine dot get property inside
the parentheses inside the single code voices. If I print the voice variable, print voices, and then
execute this code, here you can see it provide
two different voices. M two different objects. You can choose any of
these voice from the tb. I'm going to comment out
this print statement and let's select a voice. I'm going to type gene
dot set property, Using set property function, we can set any object
from our property. Then inside the set
property function in our first parameter, inside the single code, we need to pass voice. In our second parameter, we can select the voice. Voices inside the square races, I'm going to select zero dot ID, we select our first
object from our list. If you want to see
the voice name, you can print the voice
name. Let me show you. Print inside the parentheses, Vic is inside the square
races, zero dot ID. If I execute the code, Here you can see our voice name is David, it's a male voice. If you want to see the
second voice name, then you need to pass one are. If I execute this code, here you can see our
second voice name is Zyra. It's a female voice. It is up to you what you want to show. As you know, Jervis is
our male AA assistant, so I'm going to use zero are. I'm going to use David
voice for Jervis. Now, let's call
the main function. If undersco underscore name, if undersco underscore
name equal to equal to, and set the double codes, underscore underscore
main function. Then inside the main
function for now, I'm going to type pus, and then I back to
the peak function. F P t Sex three, I'm going to use S function. So I'm going to type gene dot S inside the parentheses audio, and also need to call another
function from P t ax three, which is gene dot,
run and weight. So I'm going to type gene, dot, run and weight. Also, I'm going to take
variable name for our author. So I'm going to type
author equal to Tony. You can use your name
for this example. For now, I don't need
this pre statement, so I'm going to comment out it. Then I jump into
the main function, and now I'm going to
call our speak function. I'm going to type, speak. Inside the parentheses,
I'm going to use ptring. Then inside the double codes, I'm going to type welcome. Then inside the car resis, I'm going to call
our author name. Ca, I am Jervis. This audio function,
going to speak this text. Welcome author, I'm Jervis. As you know, our
author name is Tony. I's going to speak,
welcome Tony, I'm Jervis. Let's execute this
core. Welcome, Tony. I am Jervis. So you clearly listen the
voice of our Jervis. This is it for this tutorial. In our upcoming Tutorial, we're going to create
another function which can who is the author
according to time. Thanks for watching this video, stay tuned for the next
part of this project.
3. Create wish me function to welcome the author: Welcome back guys. Once again, I'm in my viso sudo codaor. In this section, we're going to create a function
according to time. Suppose below then 12 hour, Jarvis going to wish his
author good morning. Time between 12
hour and 18 hour, Jarvis going to wish his
author good afternoon, and else it going to wish
his author good even. Let's create the
wish me function. I'm going to tie Dave Wish
Me Is the parenthesis, I don't want to
pass any argument. Instead the wise M
function, for now, I'm going to type p. Before
I create this function, we need to import a module,
which is dead time. I'm going to import dead time. We need to use this
module because we need to extract current time
from our local machine. I'm back to my wish me function. At first, we need to extract
hour from our local time. I'm going to create
a variable hour. Our equal to, I want to extract
hour in our current time. Im going to type dead time
dot dead time dot now. After now function, I want
to extract our type hour. This function going to return
hour as a string format, but we need to convert this
hour in a integer format, so I want to use int function. And we need to move it
inside the parenthesis. And now I'm going to create
which me function condition. For this, I'm going
to use ep condition. If greater than equal to zero, and less than 12, then inside the e condition, I'm going to call
the speak function. Speak. Inside the parenthesis, I'm going to use E string. As you know, if our time
is zero than pel hour, we need to speak good morning. I'm going to type good morning. Then inside the crass
or author name. LC ur greater than equal to
12 and our less less than 18, then inside this condition. Once again, I'm going to
call the speak function. Speak inside the
parenthesis, string. 12-18 hour, we basically
speak, good afternoon. I type, good afternoon. Then inside the cals author, and then inside
the els condition, speak string, and inside
the string good evening. Inside the Cali resis author. If we call this function
in morning time, it's going to wish
us good morning. If we call this function
after 12:00 A.M. It's going to wish us
with good afternoon. If it cross 18 hour, it's going to wish
us with good evening and outside the LCP condition, I want to call speak
function once again. Speak inside the parentheses, I'm going to use
Epstring once again. After hm, it going to
introduce himself. I'm going to type, hello. Inside the parentheses,
author name. Hello, Tony, I am Jervis. Also it asked for assistant. I'm going to type, please
tell me how may I help you? Tell me how may I help you? U. We successfully create
our wishb function. And now we need to call this wishb function inside
the main function. I'm going to comment
out this peak function, and I'm going to
call wishb function. Let's execute the code and see what is the
feedback of our AI. Good morning, Tony.
Hello, Tony, I am Jarvis. Please tell me how
may I help you. As you can listen,
it successfully execute our wishb function. This is it for this tutorial. In our upcoming Tutorial, we're going to take
user voice input using take common function. So state tune for
our next tutorial.
4. Take the audio input and convert it into a text : Welcome back guys. Once again, we are in my Visual
Studio Creator, and this is the most important
part of this exercise. Because in this part, we
are going to learn how can we take audio input and
convert it into a text. At first, I'm going
to create a function, which is take command. Dave, take command.
Inside the function, for now, I'm going to type pus. First, we need to
install a module to take command from the user. Once again, I open my
Windows power shell, and I'm going to type P
install speech recognation, and then I press enter. As you can see, requirement
already satisfied, but you need to complete
the download process. Let's back to the code tor. Now, first, we need to import
this module in our file. So to type, import
speech recognition as SR. Now I'm going to create a doc
string in this function, and I'm going to type
take microphone input from the user, and
return string. This function is going
to take microphone input from the user and it is
going to return a string. Then we need to call
recognizer function from this module R equal to SR dot recognizer. This recognizer function
help to take voice input. Then do microphone function a sove Then insert this
function print, listening. Now I'm going to change pose threshold value
at the pose threshold, and I'm going to increase the
pose threshold value, 1.5. Now the question is,
what is pose threshold? If I press control and
click on pose threshold, here you can see what
is pose threshold. As you can see, it's
mean seconds of non speaking audio before a
phase is considered complete. By default, it's come
with 0.8 second. It's mean after a word, you stop for more
than 0.8 second. Then it's going to
complete the phrase. If you increase the
post threshold value, then you can wait 1.5
second after a word. This is the use gage of
post threshold value, and then we need to
use son function. Audio equal to r son. Then inside the
parentheses source. Inside the Listen function, I pass the audio source. If you click the
Listen function, here you can see what
Listen function can do. If you want to understand it, you can read the whole document. Once again, I'm back to
my main dot Pi file, and now I'm going to use
tri except condition. Try inside the try block. At first, I'm going
to print a statement. Print inside the parenthesis
inside the double codes, I'm going to print recognizing. And then we need
to use the engine which can convert the
audio into a string. I'm type query equal to R dot, you can use recognizing
being, recognizing Google, recognizing Google Cloud, recognizing IVM,
recognizes snacks. You can use anything you want, but I'm going to use
recognized Google. This is the same engine, which is used in
your and red form. Recognize Google is very
powerful and so accurate. In this function, first, I'm going to pass
Audio as a parameter, and then we need
to pass language. I'm from India, so
I'm going to use EN N means English India. It's going to convert
the audio into a text, and then I'm going to print
inside the parenthesis, I'm going to use string. Inside the double course,
I'm going to type. User said User said
inside the Calass, I'm going to pass the query, and then I'm going to type
Bala n for new line character. If I show you the
recognized Google function, here you can see our
recognized Google function use Snacks engine. As I told you earlier,
this function also use in and red mobile. It's very correct. We
complete our take function. If there is a
problem in our code, then we need to
handle the exception. I'm going to type
exp exception as E, inside the exception, I
want to print a statement. Print, inside the parentheses, I'm going to use E string, Sod, and our author
name is Tony Sod Tony. Ca, say that again. And also I return
a string, none. It is not a function,
just a string, none. Outside the exception, also I
want to writ written query. Suppose you speak something, but it does not recognize. In that case, it's
going to return Sony, say that again, and
also it written none. Let's call the
function and check. Is it properly or not? First, I'm going to comment
out the wiping function, and then I'm going to call
take common function. Let's execute the code and
see, is it work or not? Hello World. As you can see it's recognizing.
Let's wait sometime. As you can see, it's
written, Hello World. User sad, Hello World. As you can see, our take command function
worked perfectly. It can listen our voice. It also recognizing our voice and convert the
voice into a text. We successfully take voice
user input from the user. In the next part
of this project, we are going to
integrate Wikipedia and search results from Wikipedia
using a voice command. Thanks for watching this video, stay tuned for our next
part of this video.
5. PyAudio Module : Maybe you face this kind of problem when you call
take command function. Attribute error could
not find Pi audio, and no module name Pi audio, and it is throw a error
in your terminal. If you try to download this
module in dos power shell, PP install Pi audio, As you can see, it connecting
the Pi audio file, but it do not complete
the download process. If you don't have required
wheel tools in your Python, in that case, you can
face this problem. Maybe some files are
missing in your computer. Let's see how we can
solve this problem. At first, you need to
open your browser, then you need to search our
visual Python binary files. Then you need to open this link. It's redirect to this website. These s are Python modules. But we need to download
Pi audio wheel file. I'm going to type
Control AP and I'm going to type Pi audio. This one. As you can see, someone already will
will file for us, and you need to
download the exact will file according to
your Python version. If I open Windows
Psion and ti Python, and then I press
enter, as you can see, our Python version is 3.10, and also it is 64 bit. According to this version, we need to download this
binary file. So click on it. As you can see, it download it, and then you need to open
the download folder, and here you can see the
will file name Pi audio. We need to install this
file as a Python module. If you are windows user first, press **** and then press right. Here you can see option
open Power sal hair. Then just you need
to type P install, and our module name is Pi audio. I'm going to type Py, and then I'm going to press tab. As you can see, it
autocomplete the final ame, and then you need to press enter to install
this wheel file. As you can see, Pi
audio is already installed with the same
version as the provided wheel. Because I already
download this file, but you need to complete
the download process. Then if I type Python, and also I import
Pi audio module. As you can see,
there is no error. Following this method, you
can install any module. Now, our take common
function worked properly. Thanks for watching this video, I hope I solve your problem.
6. Search Wikipedia using voice command : Good to see you where guys. Once again, I am in a
visual studio code tor. In this tutorial, we are
getting result from Wikipedia, using our voice command. If you want to know
about anything, you can ace your AI for result. Then Jervis going to return
result from Wikipedia. Let's start the practical. At first, I'm going to comment out the tech command function, and I'm going to
call me function. Then inset the main function, I'm going to use EP condition. If one, then inset
the ep condition, I want to run this
function for one time. If you want to run this
function over and over again, you can use il loop. And Inset the ep condition, I'm going to type quay equal to tech command function,
dot lower function. First, I'm going to convert our user query
into a lower case, and now I need to install
Wikipedia module. I'm going to open
my windows partial. Then I'm going to install
Wikipedia module, so I'm going to type,
Pep, install, Wikipedia. If I press enter,
as you can see, it print requirement
already satisfied. I already download this module, but you need to complete
the download process. Let's back to the visa studio
Coraor and type some code. Inside this EP condition, I'm going to create
another p condition. If and in this ep condition, I'm going to assign
trigger word for Wikipedia, which is Wikipedia, Wikipedia, and W is another trigger word
for Wikipedia In query. Then inside the e condition, at first, I'm going to
call this PC function. Speak and set the parentheses
searching Wikipedia. Suppose you want to search
result for Donal Trump. Then you can ask your Jervis, Donal Trump Wikipedia,
otherwise, who is Donal Trump? As you can see, our
Wikipedia ward and who word is trigger point
for Wikipedia result. It's going to return
result from Wikipedia. Then Q equal to Q dot
replace function. Dot replace function,
and I want to replace our Wikipedia keyword with
blank, sum type, Wikipedia. And I want to replace
this keyword with bank. For results, I'm going to create a variable result equal to, and now I'm going to
call a function from ukipedia module,
which is summary. I'm going to type wikipedia
dot summary function. Inside the parentheses,
dot summary function. Then inside the
parentheses at first, I'm going to pass
query as an argument. O second argument is sentences. It's mean how many sentences we want as a result
from Wukipedia. So I'm going to type sentences. Sentences equal to two. For now, I want two sentences
from Wukipedia result. But at first, we need to import Wukipedia module in our page. So to type, import Wikipedia. Then I back to the function. Next, I'm going to call
speak function once again. Sound to type, speak. And inside this speak function, I'm going to type
according to Wikipedia, according to Wikipedia. Using this Sari function, we can extract result
from Wikipedia, and I stored this result
in this result variable. Next, I'm going to print
the result, Ping results. It's going to print the two sentence
result from Wikipedia, and I also want to speak
the result using Jervis. I'm going to call speak
function once again. Speak inside the
parenthesis result. So finally, we
successfully integrate our Wikipedia module
in our Jarvis project. So it's time to run the code and see is it work
properly or not. So let's run the code. Good evening, Tony.
Hello, Tony, I am Jarvis. Please tell me how
may I help you. Who is Donald Trump? Searching Wikipedia.
According to Wikipedia, Donald John Trump, born June 14, 1946, is an American
politician, media personality, and businessman who served as the 45th president of the
United States 2017-2021. Born and raised in
Queens, New York City, Trump graduated from the Warden School of the University
of Pennsylvania with a bachelor's
degree in 1968. At first, our Jervis
assistant listen our voice, then it's recognizing our voice, and then it print the
text, what users sad. As you know, I say,
who is Donald Trump. And as you know, who
is the trigger key of Wikipedia search? That's why when I use this word, it's going to return
result from Wikipedia. And then our assistant
print our result in our terminal and
also speak our result. In our upcoming Tutorial, I'm going to integrate
live News date in our Jervis project. Thanks for watching this video, stay tuned for our next project, stay tuned for our
next Tutorial.
7. Live news update Using Voice Command : Hello guys, good
to see you back. This is the most important
section of this project. In this part, we are going to integrate Lib News
update in our project. When we ask our Jervis
for Live News update, then going to speak current news headline with their content. Let's see how it's work. First, I'm going to
create a LCP condition, L news news inquiry in query, then inside the LP condition, I'm going to speak function. Speak inside the
parentheses news headline. Then query equal to query
dot replace function, and I want to replace
new skewer with blank. To get current news updates, we need to use API. For that, I'm going
to use this website, news api dot O Rg. This website is free
for developers. At first, you need to
sign up to this account, and I don't going to cover the sign up process.
It's very easy. If you do not log
in this website, you cannot get the APIT. That's why login
is very important. Then go to the URL word
and type slash sources. If I press enter, here you
can see all the country list. So you can select your own
country for news update. I'm from India, so I'm
going to select India. Her you can see,
this is my EPIK, and we need this EPIK
for news update. I'm going to copy the EPIK. Then I'm going to back to
my VSL Studio code editor, and I'm going to
create a variable URL equal to inside
the double course, I'm going to pest my EPIK. We are getting data using EPI. That's why we need to use a
module, which is request. I'm going to import
request module. Import request. Then I'm going to
create a variable, and our variable m is news. News equal to request dot git. Using git function, we can
get result from this request. Inside the git
function, I'm going to pass URL as parameter, and then I'm going to
convert this content into a text format, dot text. As you know, most of the time, API sent JSON data, and now we need to convert
the JSON data into a Python object using
Jen dot lot function. M equal to Jen dot lot function, J dot lot function, inside the parenthesis, new. Using Jen Lots function, we convert Json data
into a Python object. But first, we need to import
JSON module in our file. I'm going to import JSON module. Now let's back to the
News API website. Suppose this is
our Python object, and we have three
property in this object, status, put result,
and articles. Inside this article object, we have more objects. At first, we need to
access the article object. Then we need to run
foreign loop to access all the objects inside
the article object. For article object, I'm
going to take a variable, and our variable
name is art equal to news inside the square ss,
our property articles. If I show you the news
website once again, as you can see
inside the article, we have a property named Title. Also we have a property
named description. Title means news headline. Description means news content. I want to access the news
headline with their content. For these, we need to use loop. Let me show you. So I'm
going to use four loop for article in art Isd
the four loop. First, I want to
print article title. I'm going to use print inside the parenthesis article
instead the square sis title. After print the article title, and I also want to speak
the article title. I want to use speak
function for that. With article title, also I want to listen
news description. I'm going to duplicate
these lines. At first, I'm going to
print the description. And also, I'm going to
speak the description. Some to copy the
description ord, and I'm going to paste
into this position. Also, I'm going to run
another speak function. Because after end of one news, it's going to jump
into the another news. And between two news,
I want to speak, moving on to the next news. Otherwise, we cannot understand
where our news was over. Some to type moving
on to the next news. Finally, we integrate a
news API in our Jervis. Let's run the code
and see is it work properly or not.
Let's run the code. Good evening, Tony.
Hello, Tony, I am Jarvis. Please tell me how
may I help you. Today news. News headlines.
Indonesian researchers breed good mosquitoes to combat
Dang, the Indian Express. The trial results
showed that deploying mosquitoes with Wilbik
or reduced dengue cases by as much as 77% and
hospitalizations by up to 86%. Moving on to the next news. Six rules, every
person with diabetes needs to follow this
festive season india.com. Follow these six rules to gain control over your sugar levels and stay healthy
even with a diabetic condition this festive season. Moving on to the next news. So as you can listen, speak all the news one by one. I hope, now this section
is clear for you, how we can useEPI and
extract news from this EPI. Thanks for watching this video. In the next part of this video, we're going to open web browser
using our voice command. You can search YouTube, you can search Google, et
cetera. Please state your.
8. Search result in search engine using voice command: Hello, guys. Good
to see you back. Once again, I am in my
Visual Studio code tor. In this section, we are
going to learn how can we search result from website
using our voice command? Suppose I want to
open google.com, and then I'm going to
command Jarvis Open Google. Then it's going to open my browser and redirect
to google.com. At fast, we need to
import a inbuilt module, which is web browser. I want to import this module. Import web browser. It is the inbuilt
module from Python, and then I'm going to create
another lip condition. L C Open Google in query. Then inside the EP condition. I'm going to call web
browser dot open function. Web browser dot open. Then inside the parentheses
inside the double course, we need to pass the domain name. Why we want to redirect. I'm going to pass google. Let's set the file
and run the code. Is it work properly or not? I'm going to hit the run button. Good evening, Tony.
Hello, Tony, I am Jarvis. Please tell me how
may I help you. Open Google. As you can see, it open my web browser and
redirect to google.com. Similarly, following
this method, you can open YouTube also. So I'm going to duplicate
the EP condition, and in our query section, I'm going to type L C
Open YouTube in query, then redirect to youtube.com. If I set this file and run
the code one more time. Good evening, Tony. Hello, Tony. I am Jervis. Please tell
me how may I help you. Open YouTube. As you can see, it redirect to youtube.com. You can open any website
using your voice command, like Facebook, gitub,
stack overflow, et cetera. But if you want to search any query in your
default search engine, for this, we need to write some two more extra
lines. Let me show you. Once again, I duplicate
this P condition. Now I want to search results from our default search engine. For this, I'm going to type
search browser in query. Search browser. Then
inside the P condition, I'm going to call
speak function. So I'm going to type Sp. Then inside the parentheses, our Jervis asks to the user, what should user search. Jervis is going to ask to the
user, what should I search? So I'm to type, what
should I search. Then I'm going to
take a variable, which can take user command. UM equal to UM
mean user command. I'm going to call take common
function, take command. Dot lower. Using lower function, we can convert the command
into a lower case. Then I'm going to search this
user query in our browser. Once again, I'm going to run
browser dot open function. Web browser dot open. Inset the parentheses,
I'm going to use string. Inset the calibraces, I'm
going to pass the user query, which is U M, M user command. Using this condition, first, I'm going to command my
Jervis search browser. Then our program redirect
to this LC condition, and then it run a speak
function. What should I search? And then you run
take common function and take voice input
from the user. And then you're going to search
the query in our browser. So let's run the code and see
is it work properly or not. So I'm going to click
on this play button. Good evening, Tony.
Hello, Tony, I am Jarvis. Please tell me how
may I help you. Search browser. What should I search? Donald Trump. As you can see, after open my browser, it serves the query,
Donald Trump. You can search any result from search engine using
voice command. Now I want to search my IP
address using voice command. I'm going to get
this ELP condition, and I'm going to
search LC IP address in IP address inquiry, then instead the P condition, I'm going to create a
variable, which is IP, IP equal to request gate
instead the Penthess, I'm going to request
to a website, which re which can
return my IP address. HTTP, colon API IP. Dot Rg. Also, I'm going to convert my request
into a text format. Dot text. We need to pass
another slash after STTP. It's going to return my IP
address in a text format. Then I want to print my IP
address in my terminal. I'm going to call
print function. Print, instead the parenthesis,
I'm going to use Ft. Instead the double codes, your IP is Your IP is
the double codes IP. I'm going to call
the IP variable. Also I'm going to
duplicate this line and I'm going to
call speak function. If I set this file and
run my code and run my code, Good evening, Tony. Hello, Tony, I am Jarvis. Please tell me how
may I help you. My IP address. Your IP is 12.79 0.16 0.58. So as you can see, we
can open websites, we can search IP address, and also we can search
query in Search engine. So in the next part
of this Tutorial, we can open different type of application using
different voice commands. So thanks for
watching this video, stay tuned for our
next Tutorial.
9. Open application using voice command : Hello, guys, good
to see you back. This is one of the most
exciting part of this project. In this section,
we're going to learn, how can we open different computer application
using voice command. Let's create the LSP condition. LEP. First, I want to open command prompt
using voice command. Inside the single codes, I'm going to type
OPN command prompt. Open command prompt in query, then inside the EP condition to open any
application or a file, we need to import OS module. I'm going to import OS module. Import OS. Then I back to the EP condition
and I'm going to type O S dot system inset the parenthesis
inset the dole codes. I'm going to type, start same. As you know, command prompt
is our system application. That's why we need to use
OS dot system function. Let's execute the code and see, is it work properly or not. I'm going to hit the button. Good afternoon, Tony.
Hello, Tony, I am Jervis. Please tell me how
may I help you. Open command prompt.
As you can see, it open Windows command prom. But now I want to open
Photoshop using voice command. For this, I'm going to
create another P condition. I'm going to gate this line, and I'm going to type LC
open photoshop in query. Then instead the P condition, I'm going to create a variable, which is Cote path. Cote path equal to
instead the double codes, we need to provide
the file location. I'm going to search
photoshop application in my search bar photoshop. Then I select the application, and I'm going to right
click on this application. He you can see option, open file location, and I'm going to click
on this location. As you can see, it provide
the file location, and then once again, I'm
going to pres click on it. Now I'm going to
click on properties. Here, you can see the
option named target. We need to copy the
target file path, so I'm going to press Control
C to copy the file path. Then back to the
Visa Studio oator, and I'm going to paste it
inside the double code. Now I'm going to remove
the extra quotation. If open photoshop in our query, then our program going
to trigger this path, and it's going to open our
photoshop application. But on to pass
multiple back slash between this fold and
name, something like that. And then I'm going to call Start file function
from OS module, st start file and
s the parentheses, I'm going to pass
this variable. Code. Let's execute the code and see is it properly work or not. I'm going to hit the run button. Good afternoon, Tony.
Hello, Tony, I am Jervis. Please tell me how
may I help you. Jervis, please open Photoshop. As you can see, it's open
by photoshop application. Using this methode, we can open any application using
our voice command. Following this similar method, I want to open iso Studio Code editor using voice command. I'm going to ret this
line once again, and I'm going to type
LC open Code in query, then, once again,
I'm going back to my s and I'm going to
type Vis Sudio Code. And then click on it. As
you can see the option, open file location,
and click on it. Then I select the icon and
click on it once again, and then I'm going
to the properties. Here you can see option target, and I'm going to copy
the target location, and then I back to my
viso stdio codaor. Then I'm going to replace
the code Perth location with this file location. Also you need to provide
multiple backslash between this holder name,
something like that. Let's execute the
code and try to open a new Viso Studio code
window in my computer. Good afternoon, Tony.
Hello, Tony, I am Jarvis. Please tell me how
may I help you. Open Code. As you can see, it opened a new visito studio
window in my computer. Following this
process, you can open any application using
your voice command. So in the next part
of this video, we're going to learn, how can we play music using
our voice command? And also we are going to learn, how can we search any
video from YouTube? Thanks for watching this video, stay tuned for next
part of this Tutorial.
10. Play music and search result in YouTube enhanced 90p: Good to see you by guys. Once again, I am in my
VSO Studio cod ator. In this tutorial,
we are going to play music using
our voice command. Not only that, we are
also going to play YouTube video using
our voice command. Suppose I want to watch
Bliger Song in YouTube. In that case, we need to command our Jervis
to play this song, and you're going to
open my browser and redirect to youtube.com
and play this song. Let's create our first function. Let's create our first condition
to play MP three music. As you can see in my
current working directory, there is a folder named music. Inside the music folder, we have to tal three
MP three song. I'm going to use the
songs for this example. First, I'm going to
create the ELP condition. P, play music in Query, in query, then inside
the EP condition, first, we need to create a
variable to store file path. Our variable name
is music directory. Music underscore DIR equal
to inside the single codes, I'm going to provide
the directory. I already copy the file path and I'm going to paste it here, and also need to provide multiple backslash
between folded names. Now I'm going to convert all
the songs in a Python list. I'm going to create a
variable songs equal to s least dar, the parentess, in this function, on to provide the file
path as a parameter. List music DAR. I'm going to copy this variable, music directory,
and paste it here. All the items in this directory, these are now Python list items. Now I want to print the
songs in my terminal, so I want to use print function. Print inside the
parentheses song. Now we need to use Os dot start file function
to play the song. I want to type O S
dot, start file. Is the parentheses, Os dot, Path dot join inside
the join function. We need to pass two parameter. Our file path and the list item. Our five path variable
name is Music directory. Music DIR, coma, and I want to play our
first song from the list. Songs instat the square braces, I'm going to pass zero, is going to play the
first song from the list. Let's execute the code and see is it work properly or not. I'm going to hit the run button. Good evening, Tony.
Hello, Tony, I am Jarvis. Please tell me how
may I help you. Play music. As you can
see, it's play our music. You can play any
particular music. Otherwise, you can
use random function to play any music
from this list. Otherwise, you can ace your AI, which music you want to play. In our upcoming video, I'm going to modify this
play music condition, and now I want to play video in YouTube
using voice command. For that, I'm going to
create another EP condition. E, play Tube command in query, in query, then inside the ELP
condition to play to video, you need to install a module, which is Pi what key. This module is very
easy to operate. Let's open the Windows Power
shal and try to download it. As you can see, I am
in my Windows partial, and now I'm going to
install Pi what kit module. P install Pi k. Then I'm
going to press enter. As you can see, the
requirement already satisfied because I
already download it, but you need to complete
your download process. Then I back to my
visuo sto correor, and I'm going to import
this module in this file. Import by what kit? As k. Then I back to
the ELP condition. At first, I'm going to
call the speak function. Speak and set the parentheses, I'm going to type, what
should I search in Tube? So to type I search in
Tube and question mark. When I command the Tube, our er is going to ask, what should I search in YouTube? Then our ger is going to
take voice user input. For this, I'm going
to create a variable, CM command equal to
take command function. And the parentheses dot lower. Using dot lower function, we can convert our text
into a lower case. Then we need to call a function
from Pi wa kit module, which is play on T. So
I'm going to type ket, play on T, instead
the parenthesis, I want to use F string. Instead the double codes, and instead the caliss, I'm going to pass CM. Pi Wakit module is
pretty powerful, and it's pretty advanced also. Now I want to play
BLR song in YouTube. Let's execute the code and see, is it worked properly or not? Good evening, Tony.
Hello, Tony, I am Jarvis. Please tell me how
may I help you. Play YouTube. What should I search in YouTube? Believer Song. As you can
see, it's open my browser. And as you can see, he played the believer
song in YouTube. First. So step by step, we made our Jervis
very powerful. In our upcoming
video, we're going to send what's up
message using Jervis. And also, we're going to
send e mail using Jervis. Thanks for watching this video, S tune for the
next part of this.
11. Send WhatsApp message using voice command enhanced 90p: Good to see you guys. In this section, we
are going to send Worsp message and e mail
using our voice command. Without wasting your
time, let's start it. At first, I'm going to send worsp message using
voice command. I'm going to create
another p condition. P. Send message in query. Then inside the ipe condition
inside the pe condition, first, I'm going to
call speak function. Speak. I set the parentheses, inset the double codes. I'm going to type, who do you
want to send the message? I'm going to type who message. Then I'm going to take a
variable to save this number, and our variable name
is num equal to input. Is the parentheses ter number. And then backslash
n for new line. Then, once again, I'm going
to call this peak function. Speak instead the parentheses,
I'm going to type. Now, Javi is going
to ask to the user, what do you want to send? I'm going to type,
what one to send. Then again, I'm going to create another variable
message is g equal to, I'm going to call the take
command lower function. Take command dot lower. Then I'm going to
call a function from Pi what kit module. O function m is
send what message. I'm going to tie k dot, send what message and set the parentheses
as a first parameter, we need to pass send number. I'm going to pass num variable. As a second parameter, we
need to pass the message. I'm going to pass MSG. Total we need to
pass four parameter. Send number, message
hour and minute. After MG variable, I'm going to call speak function once again. Speak and set the parentheses, I'm going to type,
please enter time sir. Sir. First, we need to
create variable for hour. So I'm going to type capital, capital H equal to n function, inside the n function,
I'm going to call input. I don't want this time
in a string format. I want this time in
a number format. That's why I use n function. Inside the double cos, I'm going to type enter hour. And backslash n four new line. Then I'm going to
replicate this line. For minute, I'm going
to take variable, and I'm going to
type enter minutes. As a third parameter, I'm going to send r, and as a second parameter, I'm going to send minute, and then I'm going
to save this file. But before you run this code, you should have login in. Otherwise, it's
not going to work. Let's execute the code and
see is it properly or not. But before I run this code, let's take a overview
of the p condition. After Sen Mass query, it's redirect to
this p condition. Then our Jervis going to ask, who do you want to
send the message? Then we need to enter
the send and number. Then our Jervis going to ask,
what do you want to send? Then we need to
speak our message. Also, it ask for time, when you want to
send the message. First, you need to enter hour, and then you need
to enter minutes. Then I call send what message
from Pi Wakit module. Here we pass four
parameter in this module. Number, message, hour and mini. Ke is the allys name
of Pi wake module. Let's execute the code. Good evening, Tony.
Hello, Tony, I am Jarvis. Please tell me how
may I help you. Send the message. Who do you want to
send a message? And now we need to
type this send number. First, we need to
type country code. I'm from India, so I
want to pass plus 91. And then we need to
pass the mobile number. And then I'm going to press.
What do you want to send? Hello, Tony. Please
enter time, sir. As you can see, our
current time is 18:55. So I'm going to pass
18 hour, 57 minute. After two minute, I'm
going to send the message. Now, well to wait for 62nd. As you can see in 62nd, webs com will be open after 22nd message will be
delivered. Let's wait. So I'm going to first forward. As you can see, it's open our browser and
redect to webs.com. Also, you can see it already type our
message. Hello tune. Maybe not listen Tony carefully. That's why it type hello tune. After 22nd is going
to send the message. As you can see, it send
our message, hello tune. Now it's clear for you how
we can send what's message using our voice command by
the Hipp Pi Waki module. In the next part of this video, I'm going to send e mail
using our voice command. Thanks for watching this video, stay tune for our next video.
12. Send email using voice command enhanced 90p: Otherwise, good to see you back. In this Tutorial, we're
going to learn how can we send e mail using
voice command. You can send e mail anyone. At first, I'm going
to import a module, which is SMTP LIB. Here I'm going to
tie PP install, secure SMTP LIB, and then
I'm going to prese enter. As you can see, stton, requirement already satisfied because I already download it, but you need to complete
your download process, and then I back to
the visto coor. At first, we need to import
this module in this file. Import SMTP, LIB. Then I'm going to create
the Ep condition. LC, send e mail, inquiry, then inside
the p condition. At first, I'm going to
call the speak function. Speak, inside the parenthesis,
I'm going to type. Our er is going to ask, what should I send sir? What send sir, send sir. Then I'm going to take voice
user input from the user. For this, I'm going to create a variable and our
variable limit is content content equal to
tech command function. Te command dot lower. Then once again, I'm going
to call this peak function. Speak inside the pheses
inside the double, O JV is going to ask
who to send the e mail? Email. Enter e mail
address, sir. Sir. Then we need to take e mail
address from the user. For this, I'm going to
create another variable 22 equal to input. Is the parentheses, I'm going to type
enter e mail address, and Backslash N for new line. Then I'm going to
call a function, and our function is send e mail. And Inset this function, I'm
going to pass two parameter. Our first parameter is two, and our second
parameter is contained. This function going
to send our e mail. But before we need to
create this function. But first, I want to
show you something. We are going to send e mail
using our Gmail address. You know, GML is very seQ. We need to make our
Gmail less sec. You need to open your browser. Then go to Manager
account section. Here you can see
option, security, and then you need to
turn on this future. Less secure apps. You need
to turn on this future. Otherwise, it's
not going to work. As you can see, I already on
my less secure apps option. Similarly, you need to
turn on this option. Let's back to the visual
studio correator and create the function. I'm going to type. Dave and our function
names send mail. Inside the parentheses,
I'm going to pass two parameter, two, and contain. Then insert the NML
function at first, we need to create a
variable name server. Server equal to,
I'm going to call SMT SMTP function.
Let me show you. STP. Then inset the parentheses. In our first
parameter, we need to pass the service
provided domain, which is stp gmail. Next, we need to pass
the port number, which is 587, and then we
need to call EH function. Server EH LU. These functions are already
defined in SM LIV module, and you can see the steps in documentation of this module. I don't do anything special. I just follow the step. I just follow their step. Then we need to call server
dot, start TLS function. Server, dot start TLS function. Next, we need to call
server dot login function. Server dot login. Inside the parentheses, this login function used
for authentication, and here we need to
pass two parameter. First, we need to pass our
GML address, GML address. Second, inside the double codes, you need to pass your
GML password, password. You need to type your
Gmail address heir and you need to type
your password hare. Next, we need to call
the Sen ML function from SMTP LIV module. I'm going to type
server dot Sen ML inside the parentheses, here, we need to
pass two parameter. In our first parameter, we need to paste our GM Address. So I'm going to copy this text and paste it here once again. Next, next, we need to pass
sender e mail address, which we get from the user. So I'm want to pass two here. Next, we need to pass
the e mail content, which our function get from
the user as a parameter. So I'm going to
pass content here. And then we need to run close function to
close the connection. I'm going to type server dot ps. First, you need to
establish connection to your G mail address
using this domain. Then you need to pass the port. This is the default port by
Gmail that can use anyone. Then you need to call
these two functions. These are necessary. If you want to read this
SMTP LIV documentation, you can, and then you need to
log in your G mail account. So first, you need to
pass your Giild ras, then you need to pass pass over. Next, you need to call the send mail function to
send the e mail. Once again, you need
to pass gimil a ras, and then you need to pass
these two parameters, which you get from the user. Our first parameter is
two means sender e mail, and then our next
parameter is contained. It's mean what I want to send, and then you need to close your connection using
dot close function. And now I'm going to fill this place with my
mail and my password. I put my G mail and my
password in this function. Let's back to the LP condition. When we trigger this condition
using send mail command, first, our Jer is going to ask, what should I send sir? Then we need to speak
our e mail content, and our take common
function going to convert this voice into a text. Next, our JV is going to
ask who to send the mail, enter e mail address, sir. Then we need to type
the e mail address, who we want to send. I'm going to set this e mail
address in two variable. Next, I'm going to call
the send mail function. Inside the send mail function, we need to pass two parameter. Our first parameter is two and our second parameter
is e mail content. So let's execute
the code and see, is it work properly or not. Good morning, Tony.
Hello, Tony, I am Jarvis. Please tell me how may
I help you? Send Email. What should I send,
sir? Hello World. Welcome to my World. Whom to send the e mail your
e mail address, sir. Now we need to pass
the e mail address. So I want to pass my
another email address. And then I'm going
to press enter. If I show you my inbox, as you can see, there is a new e mail from my
another e mail address. If I open this e mail,
you can see the content. Hello World. Welcome
to my World. So our Jervis is capable
to send e mail anyone. I hope no clear for you. How can we send e mail
using our voice command. Thanks for watching this video, stay tuned for our
next Tutorial.