Introduction

A online assistant, additionally called one AI assistant or digital assistant, is one application routine that understands herbal language voice commands and completes work for the user.

You are watching: Jarvis my personal assistant


*


We all recognize what is digital Assistant. If you don’t, don’t worry, open your mobile and say “Ok Google” or “Hey Siri”. Well, Google Assistant, Siri, Alexa all these are instance of virtual Assistant.

Demo and also Code YouTube Video-


Demo and Code

Content-

What we room building-Code ExplanationComplete codeGitHub RepositoryHow you have the right to contributeReferences

1. What we space building-

Our digital assistant will certainly able to carry out the followings things-

Weather forecasting, beginning Games, Launch windows Applications, open up Websites, tells you around almost whatever you ask, speak you date and also time, greetings, news, etc.

You can connect with your laptop’s microphone/console. The response generated by the assistant will screen on the console or together a decided via the speaker.

Future Updates: take self Click, Chat an ext like humans, etc. Girlfriend tell me what carry out you want. Or contribute in https://pypi.org/project/JarvisAI


2. Code Explanation-

So let’s produce our very own virtual assistant.

Notes-

All the codes is easily accessible on mine GitHub.Demo YouTube video and code YouTube video clip is also obtainable on my channel.Required links and also packages are discussed below.Sharing would certainly be appreciated.

Lets code-

2.1. Forced packages and libraries-

pip install JarvisAIThis is the latest virtual assistant module, created by me. It gives the an easy functionality of any kind of virtual assistant. The prerequisite is just Python (> 3.6).

Usage and also Features-

After installation the library you have the right to import the module-

import JarvisAIobj = JarvisAI.JarvisAssistant()response = obj.mic_input()print(response)The use is cleared by the methods name. Friend can inspect the password for example.

mic_inputtext2speechshutdownwebsite_openersend_mailtell_me_datetell_me_timelaunch_any_appweathernewstell_me

Read more about it here and also you can additionally contribute to this repo here.

2.2. Code-

Imports-

import JarvisAIimport reimport pprintimport randomObject creation of JarvisAI as per together documentation–

obj = JarvisAI.JarvisAssistant()We have created this ‘t2s(text)’ function. This will certainly convert any type of text come speech. The entire program we will usage (call) this role to create speech native text.

def t2s(text): obj.text2speech(text)We desire to consistently listen to input from the user, so this ‘mic_input()’ will try to having audio native the computer’s microphone continuously. That will process the audio and also return text in ‘res’ variable. We deserve to use this ‘res’ change to carry out some action according to user input.

while True: res = obj.mic_input()Weather Forecast: We room using a constant expression to match queries in user input. If ‘weather’ or ‘temperature’ is discovered in user entry ‘res’ then we desire to do weather forecasting. No need to write points from scratch, just speak to ‘obj.weather(city=city)’.

You just need come fetch the city indigenous user input and also pass it come the weather function. It will tell friend the weather forecasting for her city.

We deserve to pass this returned ‘weather_res’ to ‘ t2s(weather_res)’ to develop speech native ‘weather_res’ string.

while True: res = obj.mic_input()if re.search("weather|temperature", res): city = res.split(" ")<-1> weather_res = obj.weather(city=city) print(weather_res) t2s(weather_res)News: Similarly together above, match the ‘news’ word native user intake ‘res’. If matched then call ‘obj.news’.

It will certainly return 15 news as a perform of strings. So, we deserve to fetch news as ‘news_res<0>’ and also pass it to ‘t2s(news_res<0>)’.

while True: res = obj.mic_input()if re.search("news", res): news_res = obj.news() pprint.pprint(news_res) t2s(f"I have uncovered len(news_res) news. You deserve to read it. Allow me call you very first 2 that them") t2s(news_res<0>) t2s(news_res<1>)Tells around almost everything: It will certainly fetch the an initial 500 characters from Wikipedia and return them as a string. You can use ‘obj.tell_me(topic)’.

You must pass ‘topic’ come ‘tell_me(topic=topic)’. The subject is the keyword you desire to understand about.

while True: res = obj.mic_input()if re.search("tell me about", res): subject = res.split(" ")<-1> wiki_res = obj.tell_me(topic) print(wiki_res) t2s(wiki_res)Date and also Time: It will certainly tell girlfriend the present date and time of her system.

while True: res = obj.mic_input()if re.search("open", res): domain = res.split(" ")<-1> open_result = obj.website_opener(domain) print(open_result)Launch any Applications, Games, etc:

This is tiny tricky, in ‘obj.launch_any_app(path_of_app=path)’ the duty you need to pass the route of her ‘.exe’ file.

So we have produced ‘dict_app’ dictionary which is having actually an ‘app name’ as vital and ‘path’ together value. We have the right to use this ‘dict_app’ for lookup. If the user input application exists in the dictionary then us will open up it by fetching the path.

The below example is only for Chrome and also Epic Games.

while True: res = obj.mic_input()if re.search("launch", res): dict_app = "chrome": "C:\Program papers (x86)\Google\Chrome\Application\chrome.exe", "epic games": "C:\Program files (x86)\Epic Games\Launcher\Portal\Binaries\Win32\EpicGamesLauncher.exe" app = res.split(" ", 1)<1> path = dict_app.get(app)if path is None: t2s("Application path not found") print("Application path not found")else: t2s("Launching: " + app) obj.launch_any_app(path_of_app=path)Greetings and Chat, you can develop greetings and chat favor this for now.

I am working on https://pypi.org/project/JarvisAI/ to add chat sort of functionality using Tensorflow. Girlfriend can contribute to making that better.

See more: Download Guild Meister 2 Download Guild Meister 2 Hentai Game

while True: res = obj.mic_input()if re.search("hello", res): print("Hi") t2s("Hi")if re.search("how room you", res): li = <"good", "fine", "great"> response = random.choice(li) print(f"I to be response") t2s(f"I to be response")if re.search("your name|who space you", res): print("My surname is Jarvis, i am your an individual assistant") t2s("My surname is Jarvis, ns am your an individual assistant")Ask- ‘What deserve to you do?’: Here just we are using ‘obj.t2s()’to develop some speech. If you understand python, friend will quickly understand the code below-

while True: res = obj.mic_input()if re.search("what deserve to you do", res): li_commands = "open websites": "Example: "open youtube.com", "time": "Example: "what time that is?"", "date": "Example: "what date it is?"", "launch applications": "Example: "launch chrome"", "tell me": "Example: "tell me around India"", "weather": "Example: "what weather/temperature in Mumbai?"", "news": "Example: "news for today" ", ans = """I can do numerous things, for instance you can ask me time, date, weather in your city, I deserve to open websites for you, beginning application and more. Watch the perform of commands-""" print(ans) pprint.pprint(li_commands) t2s(ans)

3. Finish code-

import JarvisAIimport reimport pprintimport randomobj = JarvisAI.JarvisAssistant()def t2s(text): obj.text2speech(text)while True: res = obj.mic_input() if re.search("weather|temperature", res): city = res.split(" ")<-1> weather_res = obj.weather(city=city) print(weather_res) t2s(weather_res) if re.search("news", res): news_res = obj.news() pprint.pprint(news_res) t2s(f"I have uncovered len(news_res) news. You can read it. Permit me phone call you first 2 that them") t2s(news_res<0>) t2s(news_res<1>) if re.search("tell me about", res): topic = res.split(" ")<-1> wiki_res = obj.tell_me(topic) print(wiki_res) t2s(wiki_res) if re.search("date", res): date = obj.tell_me_date() print(date) print(t2s(date)) if re.search("time", res): time = obj.tell_me_time() print(time) t2s(time) if re.search("open", res): domain = res.split(" ")<-1> open_result = obj.website_opener(domain) print(open_result) if re.search("launch", res): dict_app = "chrome": "C:\Program papers (x86)\Google\Chrome\Application\chrome.exe", "epic games": "C:\Program documents (x86)\Epic Games\Launcher\Portal\Binaries\Win32\EpicGamesLauncher.exe" application = res.split(" ", 1)<1> path = dict_app.get(app) if route is None: t2s("Application path not found") print("Application route not found") else: t2s("Launching: " + app) obj.launch_any_app(path_of_app=path) if re.search("hello", res): print("Hi") t2s("Hi") if re.search("how are you", res): li = <"good", "fine", "great"> solution = random.choice(li) print(f"I am response") t2s(f"I to be response") if re.search("your name|who are you", res): print("My name is Jarvis, ns am your personal assistant") t2s("My name is Jarvis, i am your personal assistant") if re.search("what have the right to you do", res): li_commands = "open websites": "Example: "open youtube.com", "time": "Example: "what time it is?"", "date": "Example: "what date it is?"", "launch applications": "Example: "launch chrome"", "tell me": "Example: "tell me about India"", "weather": "Example: "what weather/temperature in Mumbai?"", "news": "Example: "news because that today" ", ans = """I have the right to do several things, for example you deserve to ask me time, date, weather in your city, I can open websites because that you, start application and more. View the list of commands-""" print(ans) pprint.pprint(li_commands) t2s(ans)

4. Github Repository

You have the right to feel totally free to use my code. Star the if you prefer my work, i ordered it on YouTube if girlfriend love.