Skip to content

Commit cdb04bf

Browse files
Create AI_Assistant_Female_Voice.py
1 parent 494e8c0 commit cdb04bf

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

AI_Assistant_Female_Voice.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import pyttsx3
2+
import webbrowser
3+
4+
# Initialize the text-to-speech engine
5+
search = pyttsx3.init("sapi5")
6+
7+
# Set the voice to a female voice
8+
voices = search.getProperty("voices")
9+
search.setProperty("voice", voices[1].id)
10+
11+
while True:
12+
# Get user input
13+
user_input = input("Enter your text: ").lower()
14+
15+
# Open YouTube if the user wants to go to YouTube
16+
if "youtube" in user_input:
17+
search.say("Opening YouTube, just wait a while")
18+
search.runAndWait()
19+
webbrowser.open("https://www.youtube.com/")
20+
21+
# Search Google if the user wants to search for something
22+
elif "search" in user_input:
23+
search.say("What do you want to search from Google?")
24+
search.runAndWait()
25+
search_items = input("Give your search keyword: ").lower()
26+
search.say("Opening your search items, just wait a while")
27+
search.runAndWait()
28+
webbrowser.open(f"https://www.google.com/search?q={search_items}")
29+
30+
# If the user input doesn't match any of the above, ask them to try again
31+
else:
32+
search.say("Oops! Please try again.")
33+
search.runAndWait()

0 commit comments

Comments
 (0)