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

Bug: Issues in script.sh (Cloning, Dependency Installation, Flask Execution & S2V Extraction Path) #188

Open
wants to merge 1 commit 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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ You can choose to set up the backend manually or use an automated shell script.
### Option 2: Automated Setup with Shell Script

1. **Run the Setup Script**:

- Configure Google API before running shell script.
- Navigate to the `backend` folder and run the following shell script:
```bash
./script.sh
source script.sh
```
- This script will automatically download and extract the Sense2Vec model, install Python dependencies, and start the Flask app.

Expand Down
26 changes: 16 additions & 10 deletions backend/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,33 @@

REPO_URL="https://github.com/AOSSIE-Org/EduAid.git"
S2V_URL="https://github.com/explosion/sense2vec/releases/download/v1.0.0/s2v_reddit_2015_md.tar.gz"
REPO_DIR="EduAid"
S2V_ARCHIVE="s2v_reddit_2015_md.tar.gz"
S2V_DIR="s2v_old"

# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
python3 -m venv venv
fi
source venv/bin/activate

if [ ! -d "$REPO_DIR" ]; then
git clone $REPO_URL
fi

# Download Sense2Vec model if it doesn't exist
if [ ! -f "$S2V_ARCHIVE" ]; then
wget $S2V_URL -O $S2V_ARCHIVE
fi

if [ ! -d "$REPO_DIR/$S2V_DIR" ]; then
mkdir -p $REPO_DIR/$S2V_DIR
tar -xzvf $S2V_ARCHIVE -C $REPO_DIR/$S2V_DIR --strip-components=1
# Extract Sense2Vec model if the directory doesn't exist
if [ ! -d "$S2V_DIR" ]; then
tar -xzvf $S2V_ARCHIVE -C . --strip-components=1
fi

# Deactivate virtual environment after completion
source deactivate

# Install dependencies
# If you're using 'python' instead of 'python3', replace 'python3' with 'python' here
python3 -m pip install -r ../requirements.txt


# Start Flask server
python server.py

# To Deactivate virtual environment
deactivate