mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat: add Ultra quality mode with BiRefNet-matting for people photos
Adds a new "Ultra" quality tier for People subject type that uses BiRefNet-matting (ONNX, 928MB) for true alpha matting instead of binary segmentation. Produces per-pixel transparency for hair wisps and fine edges that standard models miss. - Custom rembg session class loads BiRefNet-matting ONNX from GitHub releases - Zero new Python dependencies (reuses existing onnxruntime) - Model pre-downloaded in Docker build alongside existing models - Ultra option only visible when subject is People - Falls back to Best when switching to Products/General
This commit is contained in:
@@ -108,6 +108,33 @@ test.describe("Remove Background tool", () => {
|
||||
await expect(page.locator("section[aria-label='Image area'] img").first()).toBeVisible();
|
||||
});
|
||||
|
||||
test("Ultra quality visible for People, hidden for Products", async ({ loggedInPage: page }) => {
|
||||
await page.goto("/remove-background");
|
||||
|
||||
// People is default - Ultra should be visible
|
||||
await expect(page.getByRole("button", { name: "Ultra" })).toBeVisible();
|
||||
|
||||
// Switch to Products - Ultra should disappear
|
||||
await page.getByText("Products").click();
|
||||
await expect(page.getByRole("button", { name: "Ultra" })).not.toBeVisible();
|
||||
|
||||
// Switch back to People - Ultra returns
|
||||
await page.getByText("People").click();
|
||||
await expect(page.getByRole("button", { name: "Ultra" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("Ultra quality processes JPG portrait", async ({ loggedInPage: page }) => {
|
||||
await page.goto("/remove-background");
|
||||
await uploadFile(page, fixturePath("test-portrait.jpg"));
|
||||
|
||||
// Select Ultra quality
|
||||
await page.getByRole("button", { name: "Ultra" }).click();
|
||||
|
||||
await removeBgAndWait(page);
|
||||
await expect(page.locator("section[aria-label='Image area'] img").first()).toBeVisible();
|
||||
await expect(page.locator("text=Background removal failed")).not.toBeVisible();
|
||||
});
|
||||
|
||||
test("HEIC portrait - processes without error", async ({ loggedInPage: page }) => {
|
||||
await page.goto("/remove-background");
|
||||
await uploadFile(page, fixturePath("test-portrait.heic"));
|
||||
|
||||
Reference in New Issue
Block a user