Ruang Tenun Machine Learning API is a tool for automatically detecting, analyzing, and classifying various types of woven fabrics using machine learning technology.
- Python 3.x
- Flask
- Other required dependencies (specified in the
requirements.txtfile)
-
Clone the repository:
git clone https://github.com/ruang-tenun/Ruang-Tenun-ML-API.git cd Ruang-Tenun-ML-API -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Set the FLASK_APP environment variable:
export FLASK_APP=app.py # On Windows use `set FLASK_APP=app.py`
-
Run the Flask application:
flask run
The application will be available at http://127.0.0.1:5000/.
- URL:
http://127.0.0.1:5000/predict - Method:
POST - Description: This endpoint accepts an image of woven fabric and returns the classification result along with a confidence score.
-
Content-Type:
multipart/form-data(for file uploads) -
Data Params:
{ "image": <file image> }
The image parameter should be a file (JPEG, PNG, etc.) representing the woven fabric you want to classify.
-
Content-Type:
application/json -
Body:
{ "confidence_score": 0.996875524520874, "created_at": "2024-12-12T13:35:08.962219", "id": "e9b1c91d-6b48-452f-bd0e-62ceb7bb15eb", "result": "Endek Bali" }
Send an image for prediction:
curl -X POST -F 'image=@path/to/your/image.jpg' http://127.0.0.1:5000/predict