Train your own on-brand image model from a Drive folder

By General Input

Every Monday we check the folder where your design team drops approved brand photos and refresh your own image model so new visuals look like your brand.

Integrations

  • Replicate
  • Google Drive
  • Slack

Type

Agentic Task

Categories

  • Marketing
  • Operations

Every Monday at 9am, check the Google Drive folder where our design team drops approved brand photos. If enough new images have landed since the last run, fine-tune a Replicate image model on them so everything we generate later stays on brand.

Let me configure: the Google Drive folder id holding approved brand photos, the minimum number of new images required to justify a run, the Replicate base model version to train from, the destination model that receives the trained version, the trigger word that will invoke this style at generation time, and the Slack channel for the report.

Start by listing the folder with Google Drive List Files. Keep only real image files (mimeType starting with image/), and only ones added since the last successful run. Google Workspace file types cannot be downloaded directly, so ignore anything that is not an actual image. Maintain a watermark between runs holding the last run timestamp, the file ids already trained on, and the previous trained version id, so a rerun never re-consumes the same photos.

Then apply the threshold gate before spending anything. If the count of new images is below the configured minimum, stop there. Do not upload, and do not create a training. Post a short Slack message saying the run was skipped, how many new images were found, and how many are needed. A training run costs real money and takes real time, so skipping is the correct outcome, not a failure.

If the threshold is met, download each new image with Google Drive Download File Content, bundle them into a single zip archive, and upload that archive to Replicate with Create File. This upload step is required rather than optional: Drive files are private, so Replicate cannot fetch them by URL. Per the Replicate docs, "Prediction input files are passed as public HTTP URLs or data: URIs; upload private files first via POST /files and reference the returned URL." Use the URL returned by Create File as the training input.

Start the fine-tune with Replicate Create Training against the configured base model version, passing the uploaded archive URL as the training images input and the configured trigger word, with the destination model as the training target.

Then poll for the result. Per the Replicate docs, "Predictions and trainings are async: create returns an id, a status of starting, and a urls object; poll GET /predictions/{id} or GET /trainings/{id} until status is terminal." Call Get Training on a sensible interval until status is terminal, meaning succeeded, failed, or canceled. Trainings routinely take many minutes and sometimes far longer, so tolerate a long wait and treat starting or processing as normal progress rather than a problem.

When the training succeeds, post to the configured Slack channel with Send a Message: the new trained version id, how many images went into it, and a one line note on what changed since the previous run, such as the change in image count versus last time and anything notable about the new photos. Then record the new version id, the trained file ids, and the run timestamp as the watermark for next week.

If the terminal status is failed or canceled instead, post the failure detail to the same Slack channel so someone can act on it. Include the training id and the actual error message Replicate returned rather than a generic failure notice, and leave the previous version id in place as the current model so nothing downstream breaks.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentWin back LiveChat visitors whose chats went unansweredChat quality review board for LiveChat support leadsWin back no-show and cancelled appointments every morningLive Loop returns analytics with product-level drill-downNewsletter pre-flight and approval board for Mailjet sendsTurn a prospect spreadsheet into personalized sequence enrollmentsMailjet email delivery lookup console for support teamsCatch feature flags that never got switched on in productionKajabi customer support console for member access fixes