PromptSense - AI Prompt Recommendation & Semantic Search System | Python Final Year Project with Source Code
Back to ProjectRead this fully once before you start. It saves you from the two mistakes almost everyone makes.
pip --version.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.
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.
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.
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.
python app.py
Open your browser at:
http://127.0.0.1:5000
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.
"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.
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.
Our team is here to assist you with installation and setup.