Define the environment
First, create a file with your Beam App definition. You can name this whatever you want. In this example, name itapp.py.
app.py
Inference Function
Write a simple function that takes a prompt passed from the user, and returns an image generated using Stable Diffusion. Notice theimage.save() method below. You defined a file path called output.png in app.py, and that’s where your images will be saved.
run.py
Deploying the API
In your teriminal, run:
Generating images
In the dashboard, click Call API to view the API URL.
Paste the code into your terminal to make a request.
Querying the status of a job
You will use the/task API to retrieve the status of a job, passing in the Task ID.
outputs dictionary, as a pre-signed URL.