| import requests |
|
|
| |
| prompt = 'Please generate a simple blog post according to this title "What is CHATGPT"' |
|
|
| |
| api_key = 'abcd123@gmail.com' |
|
|
| |
| default_model = 'gpt-3.5-turbo' |
|
|
| |
| |
| |
| |
| model = default_model |
|
|
| |
| api_url = f'http://195.179.229.119/gpt/api.php?prompt={requests.utils.quote(prompt)}&api_key={requests.utils.quote(api_key)}&model={requests.utils.quote(model)}' |
|
|
| try: |
| |
| response = requests.get(api_url) |
| response.raise_for_status() |
|
|
| |
| data = response.json() |
| print(data) |
|
|
| except requests.RequestException as e: |
| |
| print(f'Request Error: {e}') |