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

Here completed the issue #93 #94

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
Binary file added backend/._s2v_old
Binary file not shown.
2 changes: 1 addition & 1 deletion backend/Generator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def process_file(self, file):

class QuestionGenerator:
"""A transformer-based NLP system for generating reading comprehension-style questions from
texts. It can generate full sentence questions, multiple choice questions, or a mix of the
texts. It can generate full sentence questions, multiple choice questions , or a mix of the
two styles.
To filter out low quality questions, questions are assigned a score and ranked once they have
Expand Down
6 changes: 6 additions & 0 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 27 additions & 7 deletions backend/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,43 @@ REPO_DIR="EduAid"
S2V_ARCHIVE="s2v_reddit_2015_md.tar.gz"
S2V_DIR="s2v_old"

# Step 1: Set up Python virtual environment
if [ ! -d "venv" ]; then
python3 -m venv venv
echo "Creating virtual environment..."
python3 -m venv venv || { echo "Failed to create virtual environment"; exit 1; }
fi
source venv/bin/activate

# Step 2: Clone repository if it doesn't exist
if [ ! -d "$REPO_DIR" ]; then
git clone $REPO_URL
echo "Cloning repository..."
git clone $REPO_URL || { echo "Failed to clone repository"; deactivate; exit 1; }
else
echo "Repository already exists. Skipping clone."
fi

# Step 3: Download Sense2Vec archive if not present
if [ ! -f "$S2V_ARCHIVE" ]; then
wget $S2V_URL -O $S2V_ARCHIVE
echo "Downloading Sense2Vec model..."
wget $S2V_URL -O $S2V_ARCHIVE || { echo "Failed to download Sense2Vec model"; deactivate; exit 1; }
else
echo "Sense2Vec archive already exists. Skipping download."
fi

# Step 4: Extract archive to target directory
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
echo "Extracting Sense2Vec archive..."
mkdir -p "$REPO_DIR/$S2V_DIR" &&
tar -xzvf $S2V_ARCHIVE -C "$REPO_DIR/$S2V_DIR" --strip-components=1 || {
echo "Failed to extract Sense2Vec archive";
deactivate;
exit 1;
}
else
echo "Sense2Vec directory already exists. Skipping extraction."
fi

# Deactivate virtual environment after completion
source deactivate
# Deactivate virtual environment
deactivate

echo "Setup completed successfully."
12 changes: 6 additions & 6 deletions backend/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,14 @@ def get_shortq_hard():
@app.route("/get_mcq_hard", methods=["POST"])
def get_mcq_hard():
data = request.get_json()
input_text = data.get("input_text", "")
use_mediawiki = data.get("use_mediawiki", 0)
input_text = process_input_text(input_text,use_mediawiki)
input_questions = data.get("input_question", [])
input_text = data.get("input_text", "")#Retreiving the input text
use_mediawiki = data.get("use_mediawiki", 0)#if we want to use wikipedia or not
input_text = process_input_text(input_text,use_mediawiki) #Parsing it into a function so that it can be modifies before use
input_questions = data.get("input_question", [])# Here it specify the number of questions to be generated
output = qg.generate(
article=input_text, num_questions=input_questions, answer_style="multiple_choice"
)
return jsonify({"output": output})
) # Output of generated question in the form of dictionary
return jsonify({"output": output}) #Here sending the output to the frontend

@app.route('/upload', methods=['POST'])
def upload_file():
Expand Down