final
Browse files
main.py
CHANGED
|
@@ -53,7 +53,7 @@ class TextSearchRequest(BaseModel):
|
|
| 53 |
@app.post("/search/text")
|
| 54 |
async def search_by_text(request: TextSearchRequest):
|
| 55 |
embedding = get_text_embedding(request.query)
|
| 56 |
-
matches = search_similar_images(embedding, top_k=
|
| 57 |
|
| 58 |
if not matches:
|
| 59 |
raise HTTPException(status_code=404, detail="No matching images found.")
|
|
@@ -66,7 +66,7 @@ async def search_by_image(file: UploadFile = File(...)):
|
|
| 66 |
try:
|
| 67 |
image = Image.open(BytesIO(await file.read())).convert("RGB")
|
| 68 |
embedding = get_image_embedding(image)
|
| 69 |
-
matches = search_similar_images(embedding, top_k=
|
| 70 |
|
| 71 |
if not matches:
|
| 72 |
raise HTTPException(status_code=404, detail="No similar images found.")
|
|
|
|
| 53 |
@app.post("/search/text")
|
| 54 |
async def search_by_text(request: TextSearchRequest):
|
| 55 |
embedding = get_text_embedding(request.query)
|
| 56 |
+
matches = search_similar_images(embedding, top_k=1000)
|
| 57 |
|
| 58 |
if not matches:
|
| 59 |
raise HTTPException(status_code=404, detail="No matching images found.")
|
|
|
|
| 66 |
try:
|
| 67 |
image = Image.open(BytesIO(await file.read())).convert("RGB")
|
| 68 |
embedding = get_image_embedding(image)
|
| 69 |
+
matches = search_similar_images(embedding, top_k=1000)
|
| 70 |
|
| 71 |
if not matches:
|
| 72 |
raise HTTPException(status_code=404, detail="No similar images found.")
|