First, create the conda
environment:
conda create -n chatgpt python=3.10
Then, activate the environment:
conda activate chatgpt
Finally, install the requirements:
cd /path/to/app/dir
pip install -r requirements.txt
First, you need to set your OpenAI API key into your environment variable:
On Windows, you can set your OPENAI_API_KEY
Environment Variable via the cmd prompt. Run the following in the cmd prompt, replacing with your API key:
setx OPENAI_API_KEY "<yourkey>"
This will apply to future cmd prompt window, so you will need to open a new one to use that variable with curl. You can validate that this variable has been set by opening a new cmd prompt window and typing in
echo %OPENAI_API_KEY%
On Linux / MacOS, set your OPENAI_API_KEY
Environment Variable using zsh or bash
- Run the following command in your terminal, replacing yourkey with your API key.
If you are using bash, just replace .zshrc with .bashrc
echo "export OPENAI_API_KEY='yourkey'" >> ~/.zshrc
- Update the shell with the new variable:
or
source ~/.zshrc
if you are using bash.source ~/.bashrc
- Confirm that you have set your environment variable using the following command.
echo $OPENAI_API_KEY
Backend Run Command (development):
uvicorn backend:app --reload --host 0.0.0.0 --port 8000
Or, for production mode:
uvicorn backend:app --host 0.0.0.0 --port 8000
Front-end Run Command (development):
streamlit run frontend.py
The app front-end can be accessed at localhost:8501