Title: Finetuning Your AI Model with MyMoodAI: A cURL and REST API Guide
1. Introduction
- Why Fine-Tuning Matters: Briefly explain what fine-tuning is and why it’s crucial for personalized AI image generation.
- Overview of the MyMoodAI Workflow: Summarize the steps (creating a model, uploading training images, running training, and generating new images).
2. Getting Started
- Prerequisites:
- Having
curl
installed. - Acquiring an API key from MyMoodAI.
- Understanding basic REST concepts (JSON, HTTP methods).
- Having
- Base URL and Authentication:
- Mention
https://api.mymoodai.app/rest/api
. - Show how to set
Authorization: Bearer YOUR_API_KEY
header in cURL commands.
- Mention
3. Creating a Model (Training Order)
- Endpoint Overview:
POST /order/create/model
. - Sample cURL Command:
curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "styles": [112, 5, 2572, 1421, 2214, 947, 2570, 94, 356, 43], "gender": 1 }' \ https://api.mymoodai.app/rest/api/order/create/model
- Response Explanation:
- JSON object with
id
,styles
,gender
, andstatus
.
- JSON object with
4. Uploading Training Images
- Why Multiple Images?: Discuss benefits of uploading multiple selfies for better model quality.
- Endpoint Overview:
POST /order/{order_id}/training-images/upload
- Sample cURL Command (converting an image to Base64 before uploading):
base64 selfie.jpg > selfie.txt # Then use the content of selfie.txt in the JSON payload curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "gender": "1", "image": "data:image/jpeg;base64,<BASE64_CONTENT_FROM_SELFIE_TXT>" }' \ https://api.mymoodai.app/rest/api/order/12345/training-images/upload
- Response Explanation:
- JSON object indicating the uploaded image’s ID and URL.
5. Running the Training
- Endpoint Overview:
GET /order/{order_id}/run
- Sample cURL Command:
curl -X GET \ -H "Authorization: Bearer YOUR_API_KEY" \ https://api.mymoodai.app/rest/api/order/12345/run
- Response Explanation:
- The order’s updated
status
(e.g.,STARTED
,IN_PROGRESS
).
- The order’s updated
6. Checking Training Status
- Why Poll the Status?: Some training processes can take several minutes.
- Endpoint Overview:
GET /order/{order_id}/status
- Sample cURL Command:
curl -X GET \ -H "Authorization: Bearer YOUR_API_KEY" \ https://api.mymoodai.app/rest/api/order/12345/status
- Response Explanation:
- JSON with
status
(e.g.,DONE
) and additional info.
- JSON with
7. Generating Images from the Trained Model
- Endpoint Overview:
POST /order/create
- Use the model ID as the
parent
to generate images with the newly trained model.
- Use the model ID as the
- Sample cURL Command:
curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "styles": [112, 5], "gender": 1, "parent": 12345 }' \ https://api.mymoodai.app/rest/api/order/create
- Response Explanation:
- JSON object with the new order’s
id
(used to track generation status).
- JSON object with the new order’s
8. Conclusion and Next Steps
- Review: Summarize the workflow: create model → upload images → run training → generate images.
- Additional Resources:
- Linking to official docs for advanced usage (e.g., listing styles, retrieving generated avatars).
- Suggesting best practices for uploading multiple, high-quality selfies.
Happy Fine-Tuning with MyMoodAI!