Project Testing
Project Testing
24.01.2023
!
Jujhar Singh
Class XI-D
Roll No. :-32
Shri Guru Gobind Singh Public School
1
Certificate
Acknowledgement
Table Of Contents
Certificate . . . . . . . . . . . . . . . 1
Acknowledgement . . . . . . . . . . . . . 2
Introduction to Project . . . . . . . . . 4
Introduction to Python . . . . . . . . . 5
Coding . . . . . . . . . . . . . . . . . 6
Output . . . . . . . . . . . . . . . . . 8
Bibliography . . . . . . . . . . . . . . 10
4
Introduction To Project
"Introducing the Voice Assistant project, where we
utilized the power of Python and the OpenAI API to
create a cutting-edge virtual assistant. With this project,
users can interact with the assistant using natural
language commands to perform various tasks such as
setting reminders, playing music, and answering
questions. The integration of the OpenAI API allows for
advanced language processing capabilities, making the
Voice Assistant highly responsive and accurate. The
project was designed to be user-friendly, with a simple
and intuitive interface. Overall, this project demonstrates
the potential of combining Python and the OpenAI API to
create powerful, AI-driven applications."
5
Introduction To Python
Coding
MAIN.PY :-
import openai
import pyttsx3
import speech_recognition as sr
from api_key import API_KEY
openai.api_key = API_KEY
engine = pyttsx3.init()
r = sr.Recognizer()
mic = sr.Microphone()
conversation = ""
user_name = "Jujhar"
bot_name = "Quartic"
while True:
with mic as source:
print("\nlistening...")
r.adjust_for_ambient_noise(source, duration=0.2)
audio = r.listen(source)
print("no longer listening.\n")
try:
user_input = r.recognize_google(audio)
except:
continue
response = openai.Completion.create(
engine='text-davinci-003', prompt=conversation, max_tokens=100)
response_str = response["choices"][0]["text"].replace("\n", "")
response_str = response_str.split(
user_name + ": ", 1)[0].split(bot_name + ": ", 1)[0]
engine.say(response_str)
engine.runAndWait()
api_key.py :-
API_KEY = "{Confidential}"
8
Output
9
10
Bibliography
1. GitHub. (2021). GitHub. Retrieved from https://github.com/