The Flask backend for GPTContext app that allows user to upload context files and query chat GPT AI based on it.
The project leverages dataloaders from Llama Hub AI to create indices over the data that is being fed through the front-end. The files are stored in a directory in the server to be processed and deleted after 5 minutes. The Llama index library is used to process the data which is then passed into a GPTSimpleVectorIndex to create an index.
- In the web application, drag your files into the blue zone, or select choose file and choose your files.
- Click submit.
- The files will be uploaded and processed.
- There should be a confirmation message prompting you to now start the conversation.
- The session would expire in 5 minutes and your files will be deleted from the server.
- The application will restart.
- You can always restart the session by clicking tthe refresh icon at the bottom left of the interface
- Download the project from github
- Make sure to set your OPEN_AI_KEY environment variable using keys.py or just storing it in the os.env.
- Set your BEARER_TOKEN using the same keys.py file (uncomment the part of the code that imports and use keys.py) or set it using the os environment.
- Get an OpenAI API key and store it in a file named
keys.py
at the root directory with the nameOPENAI_API_KEY
and store a random 'BEARER_TOKEN' variable. This will match the token passed from the front end for verification purposes. - Open a terminal and navigate to the project directory.
- Install the Python dependencies by running the following command:
pip install -r requirements.txt
- Run the flask server with the following command
python app.py
- Download the project from GitHub.
- Open in a terminal.
npm install
to install all dependenciesnpm start
to start the server.- Create a .env file and create a environmental variable 'REACT_APP_BEARER_TOKEN'. This would be the same with the BEARER_TOKEN at the flask backend for authentication purposes
If you want to host it locally, follow the backend configurations above and get the locally hosted link and follow the steps below & set the frontend to use that route
- In the frontend directory inside the utis/api, set the api to use your localhost
- Restart the server.
- Project should run locally now.
I welcome contributions from anyone! To contribute to this project, follow these steps:
- Fork the repository to your own GitHub account.
- Clone the forked repository to your local machine.
- Create a new branch for your changes with a descriptive name (e.g.,
fix-bug-123
). - Make your changes to the codebase.
- Commit your changes with a clear and descriptive commit message.
- Push your changes to your forked repository.
- Create a pull request (PR) from your forked repository to the original repository's
master
branch. - Describe your changes in the PR description and link to any relevant issues or pull requests.
- Wait for feedback.
Thank you for your interest in contributing to this project!