Created
February 11, 2023 15:58
-
-
Save scaery/79c3fc1d8765cd552c6beece9d57322c to your computer and use it in GitHub Desktop.
ChatGPT Terminal - Hacking with AI knowledge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import openai | |
import json | |
import io | |
openai.api_key = "YOUR-OPENAI-API-KEY" | |
question = input("\nHacking with AI knowledge... just ask a question on ChatGPT:\n\n") | |
response = openai.Completion.create( | |
model="text-davinci-003", | |
prompt=question, | |
temperature=1.0, | |
max_tokens=1000, | |
top_p=1.0, | |
frequency_penalty=0.0, | |
presence_penalty=0.0 | |
) | |
json_object = json.loads(str(response)) | |
answer = str(json_object['choices'][0]['text']) | |
f = io.open("chatgpt.log", "a", encoding="UTF-8") | |
print("\n\n# START #################################################\nYou:\n\n%s ???\n" % question, file=f) | |
print("ChatGPT:\n\n %s" % answer, file=f) | |
print("\n# END ###################################################\n", file=f) | |
f.close() | |
print(answer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment