Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added virtual environment setup for backend #81

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 34 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,45 @@ EduAid is one such project currently available in the form of a browser extensio
git clone https://github.com/AOSSIE-Org/EduAid.git
cd EduAid
```
## 2. Backend Setup

You can choose to set up the backend manually or use an automated shell script.
### 2. Backend Setup

### Option 1: Manual Setup
The backend should be set up and run inside a Python virtual environment to ensure isolated dependency management.

1. **Download the Sense2Vec Model**:
- Download the Sense2Vec model from [this link](https://github.com/explosion/sense2vec/releases/download/v1.0.0/s2v_reddit_2015_md.tar.gz) and extract the contents into the `backend` folder.
#### Step 1: Create a Virtual Environment

2. **Install Python Dependencies**:
- Navigate to the root repository folder and run the following command to install the required Python dependencies:
```bash
pip install -r requirements.txt
```
Navigate to the repository's Backend folder and create a virtual environment:

```bash
python -m venv venv
.\venv\Scripts\Activate
```
#### Step 2: Download the Sense2Vec Model

1. Download the Sense2Vec model from [this link](https://github.com/explosion/sense2vec/releases/download/v1.0.0/s2v_reddit_2015_md.tar.gz).
2. Extract the contents into the `backend` folder.

#### Step 3: Install Python Dependencies

Run the following command to install the required Python dependencies:

```bash
pip install -r requirements.txt
```

#### Step 4: Run the Flask App

Navigate to the `backend` folder and start the Flask app:

```bash
cd backend
python server.py
```

The backend server will now be active and ready for use.

---

3. **Run Flask App**:
- Navigate to the `backend` folder and start the Flask app:
```bash
python server.py
```
- This will activate the backend for the application.

### Option 2: Automated Setup with Shell Script

Expand Down
10 changes: 8 additions & 2 deletions backend/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@ fi
source venv/bin/activate

if [ ! -d "$REPO_DIR" ]; then

git clone $REPO_URL
rm -rf "$REPO_DIR/.git"
fi

if [ ! -f "$S2V_ARCHIVE" ]; then
wget $S2V_URL -O $S2V_ARCHIVE
else
echo "Sense2Vec archive already exists, skipping download."
fi

if [ ! -d "$REPO_DIR/$S2V_DIR" ]; then
echo "Extracting Sense2Vec model..."
mkdir -p $REPO_DIR/$S2V_DIR
tar -xzvf $S2V_ARCHIVE -C $REPO_DIR/$S2V_DIR --strip-components=1
else
echo "Sense2Vec model already extracted."
fi

# Deactivate virtual environment after completion
source deactivate
deactivate