Openai on Streamlit Cloud, AttributeError: type object 'FineTune' has no attribute 'prepare_data'

Hi Guys!

I am a newbie to python and streamlit. I use streamlit cloud and try to prepare training data on it.

Here is my repository and streamlit app page:

There are 3 steps:

  1. input API key
  2. upload an excel file
  3. using openai.FineTune.prepare_data to turn the excel file into a jsonl file and download it

The error message says:

2023-05-09 03:02:34.710 Uncaught app exception

Traceback (most recent call last):

File “/app/fine-tune-testing/test.py”, line 25, in
jsonl = openai.FineTune.prepare_data(df=df)
AttributeError: type object ‘FineTune’ has no attribute ‘prepare_data’

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script
exec(code, module.dict)
File “/app/fine-tune-testing/test.py”, line 32, in
except errors.AuthenticationError:
NameError: name ‘errors’ is not defined

======

Please can anyone tell me what goes wrong? Do I use the wrong version of openai in requirements.txt? Thank you so much!