This is the backend service for the Duplicate Question Pairs Predictor project. It is built using Flask and provides an API endpoint for predicting whether two questions are duplicates.
- Accepts two questions via a POST request.
- Uses a pre-trained machine learning or deep learning model to predict if the questions are duplicates.
- Returns a JSON response with the prediction result.
- Handles CORS for cross-origin requests from the frontend.
- Flask: Python web framework for building the backend API.
- Flask-CORS: To handle cross-origin requests.
- Python Libraries:
numpy,pandas: For data manipulation.jobliborpickle: For loading the pre-trained model.
Ensure you have the following installed:
- Python (v3.7 or higher)
- pip (comes with Python) or a virtual environment manager (e.g.,
venvorconda)
-
Clone the repository:
git clone https://github.com/your-username/duplicate-question-pairs-backend.git cd duplicate-question-pairs-backend -
Create a virtual environment:
python -m venv env source env/bin/activate # For Linux/Mac env\Scripts\activate # For Windows
-
Install dependencies:
pip install -r requirements.txt
-
Add your model file:
Place the pre-trained model file (model.pkl or equivalent) in the model/ directory.
-
Run the server:
python app.py
-
Access the API:
The API will be available at http://127.0.0.1:5000/predict.
Send a JSON object with the following fields:
{
"question1": "string",
"question2": "string"
}