About this model
This is an image-to-image translation model designed to convert images into an anime style.
How to use
Here is how to use it:
python
pip install onnxruntime huggingface_hub pillow numpy
import numpy as np
from huggingface_hub import hf_hub_download
from PIL import Image
import onnxruntime as ort
model_path = hf_hub_download(repo_id="User-Android/Qens", filename="Qens.onnx")
session = ort.InferenceSession(model_path)
input_name = session.get_inputs()[0].name
output_name = session.get_outputs()[0].name
input_shape = session.get_inputs()[0].shape
#output size
height = input_shape[2] if isinstance(input_shape[2], int) else 512
width = input_shape[3] if isinstance(input_shape[3], int) else 512
image = Image.open("input.jpg").convert("RGB")
image = image.resize((width, height))
input_data = np.array(image).astype(np.float32)
input_data = input_data / 127.5 - 1.0
input_data = np.transpose(input_data, (2, 0, 1))
input_data = np.expand_dims(input_data, axis=0)
result = session.run([output_name], {input_name: input_data})
output_data = result[0][0]
output_data = np.transpose(output_data, (1, 2, 0))
output_data = (output_data + 1.0) * 127.5
output_data = np.clip(output_data, 0, 255).astype(np.uint8)
output_image = Image.fromarray(output_data)
output_image.save("output.jpg")
benchmark
| name | processingspeed | imagequality | total |
|---|---|---|---|
| Qwen-image-edit-2509-photo-to-anime | 18 | 48 | 66 |
| Qens | 46 | 33 | 79 |
| AnimeGAN | 48 | 25 | 73 |
| White-box Cartoonizer | 42 | 30 | 72 |