DEV Community

peter279k
peter279k

Posted on

Web Extract Worker, a service with text-to-image worker AI models!

What I Built

In our web service, we can fill the prompt and generate image with one of the text-to-image worker AI model randomly.

The user scenario image is as folows:

User Scenario

Demo

Our front-end worker is deployed at the Cloudflare Pages.

Try out our web service!

Firstly, open the web page and browse the above link:

Step 1

Input the corgi to be the prompt and click "Generate" button:

Step 2

After waiting for about whiles, it will present generated image:

Step 3

You're done for our web service tutorial now!

My Code

Our source code is available here:

GitHub logo peter279k / web-extract-worker

The web-based extract text to image worker :).

Web Extract Worker

Introduction

The web-based extract text to image worker :).

Installation

  1. Firstly, clone or fork this repository.
  2. Second, please refer the Cloudflare Pages Docs to complete the front-end page deployment.



And our techniques are as follows:

  • Front-end: The index.html is the main page to let users input their prompts and see generated image.
  • Back-end: The extract.php is the main PHP program to handle user prompt and respond generated image.

Journey

We used these following models and the PHP program will choose them randomly when retrieving user prompts:

It's the dead simple for PHP developers to learn how to use the native PHP codes to develop a extract text to image service via the Cloudflare worker AI models :).

Top comments (0)