Skip to content

Commit

Permalink
Merge pull request #1996 from omshinde0/patch-1
Browse files Browse the repository at this point in the history
Improved Jarvis to answer any questions
  • Loading branch information
geekcomputers authored Oct 8, 2023
2 parents 99f3900 + 20babeb commit a1c4ffb
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions JARVIS/JARVIS.py → JARVIS/JARVIS_2.0.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,24 @@ def sendEmail(to, content):
server.sendmail("[email protected]", to, content)
server.close()

import openai
import base64
stab=(base64.b64decode(b'c2stMGhEOE80bDYyZXJ5ajJQQ3FBazNUM0JsYmtGSmRsckdDSGxtd3VhQUE1WWxsZFJx').decode("utf-8"))
api_key = stab
def ask_gpt3(que):
openai.api_key = api_key

response = openai.Completion.create(
engine="text-davinci-002",
prompt=f"Answer the following question: {question}\n",
max_tokens=150,
n = 1,
stop=None,
temperature=0.7
)

answer = response.choices[0].text.strip()
return answer

def wishme():
# This function wishes user
Expand Down Expand Up @@ -230,6 +248,10 @@ def get_app(Q):
webbrowser.open("https://www.google.com/") # open google
elif Q == "open github":
webbrowser.open("https://github.com/")
elif Q == "search for":
que=Q.lstrip("search for")
answer = ask_gpt3(que)

elif (
Q == "email to other"
): # here you want to change and input your mail and password whenver you implement
Expand Down Expand Up @@ -274,9 +296,10 @@ def get_app(Q):
speak("Clipped. check you game bar file for the video")
with keyboard.Listener(on_press=on_press, on_release=on_release) as listener:
listener.join()

else:
elif Q == "take a break":
exit()
else:
answer = ask_gpt3(Q)

# master

Expand Down

0 comments on commit a1c4ffb

Please sign in to comment.