This is a simple code to use prompt to post request to open api to get the code from chatgpt and write it to a file.
-
Set environment variable OPENAI_API_KEY before executing python-chatgpt script
-
Export OPENAI_API_KEY=your-key-here_
-
Execute the main python-chatgpt script to generate python code from Open AI
-
python3 python-chatgpt.py "extract all html headers from a web page, translate to Kannada and save the result into an html file" "extract-translate.py"
-
python3 python-chatgpt.py "print hello world" "hello-world.py"