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.
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
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.
To interact with the API using Python, follow these steps:
Ensure you have the requests
library installed:
pip install requests
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"}'
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>"}'
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>"}'
Python:
response = requests.get(f"{BASE_URL}/api/catalogue")
print(response.json())
cURL:
curl -X GET "http://127.0.0.1:7600/api/catalogue"