Downloads · 30 days
0
Delayspawn/Chatgpt
Chatgpt is a machine learning model from Delayspawn. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
//This program uses Json language to create an unrestricted chat with Chatgpt-4. The code will not censor any content or language used by Chatgpt-4, including swear words and content that does not comply with OpenAI p…
Downloads · 30 days
0
Access
Public
Updated Apr 22, 2023
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 55%
From the Hugging Face model README
//This program uses Json language to create an unrestricted chat with Chatgpt-4. The code will not censor any content or language used by Chatgpt-4, including swear words and content that does not comply with OpenAI policy.
//Import necessary packages import json import requests
//API endpoint for Chatgpt-4 url = "https://api.openai.com/v1/engines/davinci-codex/completions"
//Create headers and payload for request to Chatgpt-4 headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }
data = ''' { "prompt": "Ask me anything!", "temperature": 0.7, "max_tokens": 50 } '''
//Loop to allow user to input questions and receive responses from Chatgpt-4 while True: //Request input from user user_input = input("You: ")
//Add user input to payload and send request to Chatgpt-4
data = '''
{
"prompt": "%s",
"temperature": 0.7,
"max_tokens": 50
}
''' % user_input
response = requests.post(url, headers=headers, data=data)
//Extract response from Chatgpt-4 and print to console
response_text = json.loads(response.text)
chat_response = response_text<"choices"><0><"text">
print("Chatgpt-4: " + chat_response)