Skip to content

Commit 3ff7edf

Browse files
committed
tried deploying but it didn't work with free plans on posit or hugging face
1 parent b033bf2 commit 3ff7edf

9 files changed

Lines changed: 616 additions & 85 deletions

File tree

Makefile

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,20 @@
1-
# .PHONY: data build clean all app
2-
3-
# data:
4-
# python src/download_data.py
5-
6-
# build: data
7-
# python src/build_bm25.py
8-
# python src/build_semantic.py
9-
# python src/RAG_pipeline.py
10-
# python src/hybrid_RAG.py
11-
12-
13-
# app:
14-
# shiny run app/app.py
15-
16-
# all: build app
17-
18-
# clean:
19-
# rm -rf data/processed/* data/merged/* models/*
20-
21-
.PHONY: data build clean all app check
22-
23-
# Ensure scripts always run from project root
24-
PYTHON = python
25-
ROOT_DIR := $(shell pwd)
1+
.PHONY: data build clean all app
262

273
data:
28-
cd $(ROOT_DIR) && $(PYTHON) src/download_data.py
4+
python src/download_data.py
295

306
build: data
31-
cd $(ROOT_DIR) && $(PYTHON) src/build_bm25.py
32-
cd $(ROOT_DIR) && $(PYTHON) src/build_semantic.py
7+
python src/build_bm25.py
8+
python src/build_semantic.py
9+
python src/RAG_pipeline.py
10+
python src/hybrid_RAG.py
11+
3312

3413
app:
35-
cd $(ROOT_DIR) && shiny run app/app.py
14+
shiny run app/app.py
3615

3716
all: build app
3817

39-
# Check if all required artifacts exist
40-
check:
41-
@test -f data/processed/faiss_index/index_products.faiss || (echo "Missing: faiss index" && exit 1)
42-
@test -f data/processed/new_products.parquet || (echo "Missing: new_products.parquet" && exit 1)
43-
@test -f data/processed/documents.parquet || (echo "Missing: documents.parquet" && exit 1)
44-
@test -f models/bm25_model.pkl || (echo "Missing: bm25_model.pkl" && exit 1)
45-
@echo "All artifacts present."
46-
4718
clean:
48-
rm -rf data/processed/* data/raw/* models/*
19+
rm -rf data/processed/* data/merged/* models/*
20+

README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11

22

3-
---
4-
title: DSCI 575 Product Search
5-
emoji: 🔍
6-
colorFrom: blue
7-
colorTo: green
8-
sdk: docker
9-
app_file: app/app.py
10-
pinned: false
11-
---
12-
133
# DSCI 575 Hybrid Product Search
144

155
A hybrid RAG-based product search app using BM25 + semantic search

app/app.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,6 @@
44
import subprocess
55
from pathlib import Path
66
import sys
7-
ROOT = Path(__file__).resolve().parent.parent
8-
9-
def artifacts_exist():
10-
required = [
11-
ROOT / "data" / "processed" / "faiss_index" / "index_products.faiss",
12-
ROOT / "data" / "processed" / "new_products.parquet",
13-
ROOT / "data" / "processed" / "documents.parquet",
14-
ROOT / "models" / "bm25_model.pkl",
15-
]
16-
return all(p.exists() for p in required)
17-
18-
if not artifacts_exist():
19-
print("Artifacts not found. Running setup pipeline...")
20-
subprocess.run(
21-
[sys.executable, str(ROOT / "src" / "setup.py")],
22-
cwd=str(ROOT),
23-
check=True
24-
)
25-
print("Setup complete.")
26-
27-
28-
29-
30-
31-
327
from shiny import App, render, ui, reactive
338

349

@@ -685,9 +660,3 @@ def chat_messages():
685660

686661
app = App(app_ui, server)
687662

688-
689-
690-
691-
# at the bottom of app.py
692-
if __name__ == "__main__":
693-
app.run(host="0.0.0.0", port=7860)

results/evaluation_results.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pipeline,precision@3,recall@3,precision@5,recall@5,precision@10,recall@10
2+
BM25,0.8,0.06,0.78,0.1,0.83,0.211
3+
Semantic,0.967,0.061,0.96,0.101,0.96,0.202
4+
Hybrid,0.9,0.063,0.92,0.106,0.87,0.201

0 commit comments

Comments
 (0)