Skip to content

clozetteai/hnm-search

Repository files navigation

Clozette.AI

1

Clozette.AI: We speak SQL, so you can speak fashion! 😝 We translate your clothing descriptions into database queries, making it easier than ever to find the perfect outfit.

Creators

Overview

5

Setting Up the Backend

To set up the backend, you need to first create an environment and install the requirements from the provided file:

cd backend
pip install -r requirements.txt

NOTE: Ensure you gather all the credentials shown in backend/.env.template and create a .env file in the backend directory.

Next, download all the assets from this Google Drive link and place them in the backend/assets folder. Unzip the downloaded file inside this folder, then delete the zip file.

For a sanity check, you can run the following command to ensure the server is running:

# In the ./backend directory run:
uvicorn main:app --reload --port 7600

# Then, test the server by running the following command:

cd tests
pytest test_backend.py

Using the API

Currently, there are two hosted API servers. One of them is the embedding service and full-backend logic, where as the other is as a image-file storage system

You don't need to do anything with this. To interact with the backend, run the backend server on your local machine and use the following base URL.

Python Integration Guide

To interact with the API using Python, follow these steps:

Prerequisites

Ensure you have the requests library installed:

pip install requests

Step 1: Send a POST Request with Text Only

Python:

import requests

BASE_URL = "http://127.0.0.1:7600"
payload = {"customer_message": "birthday gift for my baby boy"}
response = requests.post(f"{BASE_URL}/api/search", json=payload)
print(response.json())

cURL:

curl -X POST "http://127.0.0.1:7600/api/search" \
-H "Content-Type: application/json" \
-d '{"customer_message": "birthday gift for my baby boy"}'

Step 2: Send a POST Request with Image Only

Python:

payload = {"attached_image": image_base64}
response = requests.post(f"{BASE_URL}/api/search", json=payload)
print(response.json())

cURL:

curl -X POST "http://127.0.0.1:7600/api/search" \
-H "Content-Type: application/json" \
-d '{"attached_image": "<image_base64>"}'

Step 3: Send a POST Request with Both Image and Text

Python:

payload = {
    "customer_message": "birthday gift for my baby boy",
    "attached_image": image_base64
}
response = requests.post(f"{BASE_URL}/api/search", json=payload)
print(response.json())

cURL:

curl -X POST "http://127.0.0.1:7600/api/search" \
-H "Content-Type: application/json" \
-d '{"customer_message": "birthday gift for my baby boy", "attached_image": "<image_base64>"}'

Step 4: Retrieve the Catalogue with a GET Request

Python:

response = requests.get(f"{BASE_URL}/api/catalogue")
print(response.json())

cURL:

curl -X GET "http://127.0.0.1:7600/api/catalogue"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published