Documentation

Installation Guide

PromptSense - AI Prompt Recommendation & Semantic Search System | Python Final Year Project with Source Code

Step-by-step Setup Verified Instructions Chat Support
Back to Project
Complete Guide

Setting Up PromptSense

Read this fully once before you start. It saves you from the two mistakes almost everyone makes.

Prerequisites

  • Python 3.10 or newer. Grab it from python.org. During installation on Windows, tick the checkbox that says "Add Python to PATH" — if you miss it, every command below fails with "python is not recognized" and you'll waste an hour figuring out why.
  • pip, which comes bundled with Python. Check it with pip --version.
  • Around 2 GB of free disk space. The Sentence-BERT model, the embeddings file, and the generated charts add up.
  • Jupyter or VS Code to run the training notebook. VS Code with the Python extension is easier if you've never opened a notebook before.
  • A working internet connection for the first setup only. After that, offline is fine.

Step 1 — Open the project folder in a terminal

Extract the downloaded zip, then open Command Prompt or Terminal inside that folder.

cd "AI-Based Prompt Recommendation and Semantic Search System Using NLP"

Keep the quotes. The folder name has spaces in it and your terminal will choke without them.

Step 2 — Create a virtual environment

Skip this and you'll install these packages system-wide, which will eventually break some other project of yours. Two commands, do it properly.

python -m venv venv

Then activate it. On Windows:

venv\Scripts\activate

On macOS or Linux:

source venv/bin/activate

You'll know it worked when (venv) appears at the start of your terminal line.

Step 3 — Install the dependencies

pip install -r requirements.txt

This pulls in Flask, sentence-transformers, scikit-learn, pandas, numpy, matplotlib, seaborn, wordcloud and joblib. The sentence-transformers install drags PyTorch along with it, which is a big download, so give it a few minutes and don't panic when the terminal looks stuck.

Step 4 — Generate the model artifacts

This is the step people skip, and then they wonder why app.py crashes. Check whether a model/ folder exists in the project root. If it doesn't, build it by running the training notebook once:

jupyter nbconvert --to notebook --execute --inplace prompt_recommendation_training.ipynb

Prefer clicking over typing? Open prompt_recommendation_training.ipynb in VS Code or Jupyter and run every cell top to bottom. Either way it reads llm_prompts.csv, downloads all-MiniLM-L6-v2, encodes all 2,152 prompts, saves the charts into static/images/charts/, and writes the embeddings and joblib bundle into model/.

Takes 3 to 10 minutes depending on your machine. Go make chai.

Step 5 — Run the app

python app.py

Open your browser at:

http://127.0.0.1:5000

Step 6 — Confirm it actually works

Don't just check that the page loads. Go to /recommend and search for something phrased completely differently from any prompt title. Try: I want to create a Python project for detecting fake news. If a prompt called Factcheck comes back with a similarity score around 50 percent, your embeddings loaded correctly and the whole pipeline is working.

Then test the API from a second terminal:

curl -X POST http://127.0.0.1:5000/api/recommend -H "Content-Type: application/json" -d "{\"query\": \"help me write a resume\", \"top_n\": 5}"

You should get JSON back with a results array and an elapsed_ms value. Screenshot that for your report — examiners like seeing a working API.

Common issues

"FileNotFoundError: model/prompt_embeddings.npy" — you ran app.py before the notebook. Go back to step 4, let the notebook finish completely, then try again.

"OSError: We couldn't connect to huggingface.co" — the model download failed, usually college wifi blocking it or the connection dropping mid-download. Switch to mobile hotspot and re-run the encoding cell. Delete any half-written folder under model/sentence_transformer/ first, otherwise it tries to load a corrupted copy.

"Address already in use" on port 5000 — something else is holding the port, and on macOS it's often AirPlay Receiver. Either turn that off in System Settings or change the port at the bottom of app.py to 5001.

Charts missing on the Visualize page — the notebook didn't finish. Its later cells are what write the PNGs into static/images/charts/, so re-run all cells to the end.

One thing to remember while developing

The app runs with use_reloader=False on purpose. Loading the embedding model on every file save would make development painful. So if you edit app.py, stop the server with Ctrl+C and start it again manually. Nothing is broken, it just doesn't auto-restart.

Need Help?

Our team is here to assist you with installation and setup.

Chat with Us