Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
20_21-J09
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
20_21-J09
20_21-J09
Commits
66d3ec02
Commit
66d3ec02
authored
Feb 14, 2021
by
IT17167338_Minoli Pemmawadu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload python File
parent
1010d0d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
0 deletions
+107
-0
ver.py
ver.py
+107
-0
No files found.
ver.py
0 → 100644
View file @
66d3ec02
import
webbrowser
import
wikipedia
import
wolframalpha
import
speech_recognition
as
sr
import
os
from
gtts
import
gTTS
import
wx
text1
=
"Welcome IntelJr! Hello I am minoli - the IntelJr Assitant. How can I help you? "
text2
=
"Here is the answer you searched for :"
language
=
"en"
myobj1
=
gTTS
(
text
=
text1
,
lang
=
language
,
slow
=
False
)
myobj2
=
gTTS
(
text
=
text2
,
lang
=
language
,
slow
=
False
)
myobj1
.
save
(
"welcome.mp3"
)
myobj2
.
save
(
"Answer.mp3"
)
app_id
=
'26Q368-9Q9ERTXHP6'
client
=
wolframalpha
.
Client
(
app_id
)
class
MyFrame
(
wx
.
Frame
):
def
__init__
(
self
):
wx
.
Frame
.
__init__
(
self
,
None
,
pos
=
wx
.
DefaultPosition
,
size
=
wx
.
Size
(
450
,
100
),
style
=
wx
.
MAXIMIZE_BOX
|
wx
.
SYSTEM_MENU
|
wx
.
CAPTION
|
wx
.
CLOSE_BOX
|
wx
.
CLIP_CHILDREN
,
title
=
"INTELJR"
)
panel
=
wx
.
Panel
(
self
)
my_sizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
lbl
=
wx
.
StaticText
(
panel
,
label
=
"Hello I am minoli- the IntelJR Assistant. How can I help you?"
)
my_sizer
.
Add
(
lbl
,
0
,
wx
.
ALL
,
5
)
self
.
txt
=
wx
.
TextCtrl
(
panel
,
style
=
wx
.
TE_PROCESS_ENTER
,
size
=
(
400
,
30
))
self
.
txt
.
SetFocus
()
self
.
txt
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
self
.
OnEnter
)
my_sizer
.
Add
(
self
.
txt
,
0
,
wx
.
ALL
,
5
)
panel
.
SetSizer
(
my_sizer
)
self
.
Show
()
os
.
system
(
" start Welcome.mp3"
)
def
OnEnter
(
self
,
event
):
input
=
self
.
txt
.
GetValue
()
input
=
input
.
lower
()
if
input
==
''
:
r
=
sr
.
Recognizer
()
with
sr
.
Microphone
()
as
source
:
audio
=
r
.
listen
(
source
)
try
:
self
.
txt
.
SetValue
(
r
.
recognize_google
(
audio
))
except
sr
.
UnknownValueError
:
print
(
"Google Speech Recognition could not understand audio"
)
except
sr
.
RequestError
as
e
:
print
(
"Could not request results from Google Speech Recognition service; {0}"
.
format
(
e
))
string_query
=
input
.
split
(
' '
)
first_word
=
string_query
[
0
]
# noinspection PyBroadException
try
:
if
first_word
==
'open'
:
website_name
=
string_query
[
1
]
url
=
"https://www."
+
website_name
+
".com"
webbrowser
.
open_new_tab
(
url
)
if
input
==
'open my college website'
:
url3
=
"https://www.tcetmumbai.in/"
webbrowser
.
open_new_tab
(
url3
)
# if input == 'open google':
#
# url = "http://google.com"
# webbrowser.open(url, new=2)
# elif input == 'open youtube':
#
# url2 = "http://youtube.com"
# webbrowser.open(url2, new=2)
# elif input == 'open linkedin':
#
# url4 = "http://linkedin.com"
# webbrowser.open_new_tab(url4)
# else:
# print("Invalid input. Please try again.")
else
:
res
=
client
.
query
(
input
)
answer
=
next
(
res
.
results
)
.
text
print
(
answer
)
os
.
system
(
"start Answer.mp3"
)
text3
=
answer
myobj3
=
gTTS
(
text
=
text3
,
lang
=
language
,
slow
=
False
)
myobj3
.
save
(
"Response.mp3"
)
os
.
system
(
"start Response.mp3"
)
except
:
# noinspection PyBroadException
try
:
input
=
input
.
split
(
' '
)
input
=
' '
.
join
(
input
[
2
:])
print
(
wikipedia
.
summary
(
input
))
os
.
system
(
"start Answer.mp3"
)
except
:
print
(
" "
)
if
__name__
==
"__main__"
:
app
=
wx
.
App
(
True
)
frame
=
MyFrame
()
app
.
MainLoop
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment