Readme
CraterView.ai Enhance
Enlarge a photo up to 4 times and rebuild fine detail at the new size. Small face enhancement then redraws small, blurry faces in the enlarged photo, unless you switch it off.
The work runs on CraterView.ai through its public API. This model sends your photo there under your own API key and returns the result.
Before you run it
You need a CraterView.ai API key. Get one from your
dashboard. Making one costs nothing, and without credit or a
subscription your jobs run free on the community queue, which shares donated compute, so the
wait is longer when it is busy. Pass the key as api_key. Replicate treats it as a secret and
removes it once the run has it.
What a run costs
There are two charges, and they are separate:
- CraterView.ai charges the job to your account, as it would through its API, at the prices on craterview.ai, or nothing on the community queue. Small face enhancement is a second job, charged on its own.
- Replicate bills its CPU time while the run waits for the result.
The settings
scale is how many times larger the result is, from 1 to 4; left empty, it is 4.
small_faces switches the second step off. Every other setting is left at the model’s own
default, which gives a good result. The API and the Python client offer all of them.
Good to know
- Fine detail is drawn at the new size, not recovered. Check anything that has to be faithful.
- A small face is drawn to fit the photo, not recovered, and may not look like the person. More: https://craterview.ai/features/small-faces.
- If Small face enhancement cannot run, you get the enlarged photo, and the run’s log says why.
- A photo larger than your account’s limit is refused. The API and the web app can work on a part of it.
- A run waits up to 25 minutes for each result. If a job is still running then, the run fails and names it: the job carries on, is charged only if it succeeds, and can be collected through the API. Cancelling a run on Replicate ends the wait, not the job.
- Your photo is sent to CraterView.ai to be processed. It is deleted automatically on the schedule in the privacy policy, and it is never used to train a model.
More about this tool: https://craterview.ai/features/enhance.
Run it from your own code
import os
import replicate
output = replicate.run(
"craterviewai/enhance",
input={
"image": open("photo.jpg", "rb"),
"api_key": os.environ["CV_API_KEY"],
"scale": 2,
},
)
# The result is one image, which Replicate sometimes returns in a list of one.
image = output[0] if isinstance(output, list) else output
print(image.url)
To call CraterView.ai directly, without Replicate, use the Python client:
from craterview import CraterView
cv = CraterView(api_key="cv_...")
cv.run("photo.jpg", model="cv-enhance-v3").save("result")
What each model takes, its limits and its price are in the API reference.