bgbye routing fix

This commit is contained in:
makearmy 2025-10-15 19:05:56 -04:00
parent 3c76ab69e5
commit c1fbdc843c
4 changed files with 56 additions and 50 deletions

View file

@ -194,7 +194,8 @@ export default function BackgroundRemoverPage() {
fd.append("file", blobToSend);
fd.append("method", key);
const res = await fetch("/api/bgremove", { method: "POST", body: fd });
// CHANGED: call local proxy instead of a hardcoded service
const res = await fetch("/api/bgbye/process", { method: "POST", body: fd });
if (!res.ok) {
const txt = await res.text().catch(() => "");
const retryable = /out of memory|onnxruntime|cuda|allocate|500/i.test(txt);
@ -320,7 +321,8 @@ export default function BackgroundRemoverPage() {
const fd = new FormData();
fd.append("file", file);
fd.append("method", active);
const res = await fetch("/api/bgremove", { method: "POST", body: fd });
// CHANGED: call local proxy instead of a hardcoded service
const res = await fetch("/api/bgbye/process", { method: "POST", body: fd });
if (!res.ok) throw new Error(await res.text());
const outBlob = await res.blob();
const ms = performance.now() - t0;
@ -373,10 +375,10 @@ export default function BackgroundRemoverPage() {
{file?.name ?? <span className="italic"> none </span>}
</div>
{/* Preview frame */}
{/* Preview frame (border removed per your note) */}
<div
ref={frameRef}
className="app-frame checkerboard relative w-full rounded-2xl border border-zinc-800/80 shadow-inner"
className="app-frame checkerboard relative w-full rounded-2xl shadow-inner"
style={{ aspectRatio: `${aspect}`, maxWidth: "1200px", maxHeight: "80vh", marginInline: "auto" }}
onDragOver={(e) => e.preventDefault()}
onDrop={onDrop}
@ -475,7 +477,7 @@ export default function BackgroundRemoverPage() {
{pendingCount > 0 ? `Running… ${doneCount}/${METHODS.length}` : "Run all methods"}
</button>
{/* GPU-safe toggle: sits next to Run All on mobile; keeps position naturally on larger screens */}
{/* GPU-safe toggle */}
<label className="flex items-center gap-2 text-sm text-zinc-300 cursor-pointer select-none order-1">
<input type="checkbox" checked={gpuSafe} onChange={(e) => setGpuSafe(e.target.checked)} /> GPU-safe mode
</label>
@ -494,7 +496,7 @@ export default function BackgroundRemoverPage() {
)}
</div>
{/* Right-side controls collapse under on mobile */}
{/* Right-side controls */}
<div className="sm:ml-auto flex items-center gap-3 w-full sm:w-auto order-3">
<input
type="range"
@ -536,4 +538,3 @@ export default function BackgroundRemoverPage() {
</div>
);
}