File size: 1,719 Bytes
9293eee
 
0a9fd6d
 
9293eee
 
0a9fd6d
9293eee
 
0a9fd6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8bda539
0a9fd6d
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
title: Visual Product Matcher
emoji: πŸ›οΈ
colorFrom: blue
colorTo: pink
sdk: docker
app_port: 7860
---

# πŸ›οΈ Visual Product Matcher – StyleSense

πŸš€ **Visual Product Matcher** is a FastAPI-based backend deployed on Hugging Face Spaces.  
It uses **CLIP (ViT-B/32)** embeddings + **FAISS** to find visually similar products from a catalog.  

---

## πŸ”‘ Endpoints

### `GET /`
Health check – returns a status message.

**Example Response:**
```json
{
  "message": "πŸš€ Visual Product Matcher API is running!"
}
POST /search_text
Search products by text query.

Form Data Params:

query (str, required) β†’ Your search text

top_k (int, default=5) β†’ Number of results

min_score (float, default=0.0) β†’ Similarity threshold

Example:

bash
Copy code
curl -X POST https://Yashashvibhardwaj-Visual_product_matcher.hf.space/search_text \
  -F "query=red sneakers" \
  -F "top_k=5"
POST /match
Search products by image (upload or URL).

Form Data Params:

file (UploadFile, optional) β†’ Image file

image_url (str, optional) β†’ Image URL

top_k (int, default=5) β†’ Number of results

min_score (float, default=0.0) β†’ Similarity threshold

Example with URL:

bash
Copy code
curl -X POST https://Yashashvibhardwaj-Visual_product_matcher.hf.space/match \
  -F "image_url=https://images.unsplash.com/photo-1542291026-7eec264c27ff" \
  -F "top_k=5"
Example with file:

bash
Copy code
curl -X POST https://Yashashvibhardwaj-Visual_product_matcher.hf.space/match \
  -F "file=@example.jpg" \
  -F "top_k=5"
βš™οΈ Tech Stack
FastAPI – API framework

Sentence-Transformers (CLIP ViT-B/32) – embeddings

FAISS – similarity search

Docker – containerized deployment

Hugging Face Spaces – hosting