You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Simple ChatGPT Class that enables both text and image prompt
2
-
// to use this class in another file just import it and call one of the 2 functions createTextRequest() or generateImage() with your prompt (or options)
3
-
//
4
-
// Example:
5
-
//
6
-
// include_once('ChatGPT.php'); // include class from folder
7
-
// $ai = new ChatGPT(); // initialize class object
8
-
// echo $ai->generateImage('a cat on a post lamp'); // print the image URL
9
-
// echo $ai->createTextRequest('what is the weather in Romania?') // print the text response
10
-
// // https://github.com/Radulepy/PHP-ChatGPT
1
+
<!-- Simple ChatGPT Class that enables both text and image prompt
2
+
to use this class in another file just import it and call one of the 2 functions createTextRequest() or generateImage() with your prompt (or options)
11
3
12
-
<?php
4
+
Code Example:
5
+
6
+
include_once('ChatGPT.php'); // include class from folder
7
+
$ai = new ChatGPT(); // initialize class object
8
+
echo $ai->generateImage('a cat on a post lamp')['data'] ?? 'ERROR!'; // print the image URL or error text
9
+
echo $ai->createTextRequest('what is the weather in Romania?')['data'] ?? 'ERROR!'; // print the text response or error text -->
0 commit comments