This Ruby on Rails App reads and stores complaints submitted on the main page into a categorized database using RAG.
Here are the dependencies/ that need to be installed to run this app:
-
Ruby on Rails
Ruby on Rails Installation Guide -
PostgreSQL
PostgreSQL Installation Guide -
Python 3 & Python3-Virtual Environment
Python Installation Guide'
Before installing Python dependencies, set up a virtual environment to manage them:
- Create a Virtual Environment Navigate to the project directory and create a virtual environment:
python3 -m venv venv- Activate the Virtual Environment On macOS/Linux:
source venv/bin/activateon Windows:
venv\Scripts\activate- Install Python Dependencies With the virtual environment activated, install the necessary dependencies:
cd flask_app/
pip install Flask
# This install all the RAG model dependencies
pip install langchain langchain-community openai tiktoken pinecone-client langchain_pinecone unstructured pdfminer==20191125 pdfminer.six==20221105 pillow_heif unstructured_inference youtube-transcript-api pytube sentence-transformersAfter installing the needed dependencies, follow these steps to get started with the application:
-
Clone the Repository
First, clone this repository to your local machine using Git:git clone https://github.com/apurva-honrao/Headstarter-hackathon.git
-
Navigate to the Project Directory
Change to the project directory:cd Headstarter-hackathon -
Install all RubyonRails dependencies
bundle install
-
Initiate the Postgresql database:
rails db:create rails db:migrate
-
Then and run the Ruby on Rails app:
rails server
-
open up a different shell and Run the Flask app
Open a terminal and navigate to the project directory:cd flask_app/ ./app.py -
Now that the app is running, navigate to 'localhost:3000/complaints/new' port where it is running and enter your complaint. This is stored in the PostGres database which can be viewed by going back to the directory and running:
rails console
-
Then in the console, run:
Complaint.all
You should be able to see the complaints stored in the database here with their respective categories.