Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Merge branch 'r4/layers-ocr' into claude/fuobe-parity-4

Claude9c82c6df2c61
diff --cc src/components/layers/tools.tsx
index 51c66b22,fa88a70f..1cb4c7d3
--- a/src/components/layers/tools.tsx
+++ b/src/components/layers/tools.tsx
@@@ -480,28 -568,36 +568,36 @@@ function EditTextTool()
<div className="space-y-4">
<Scope node={node} />
<HowItWorks>Edit text finds the text on your image and lists it here. Change any line, then generate a new image with your wording in the original design.</HowItWorks>
- {engine === "cloud" ? (
- !rows.length && (
- <div className="space-y-2">
- <Button variant="secondary" className="w-full rounded-full" onClick={startDetect} disabled={busy || !!detecting}>
- {detecting ? <Loader2 className="animate-spin" /> : <Type />} {detecting ? "Reading the text…" : "Detect text"}
- </Button>
- <p className="text-center font-mono text-[11px] text-muted-foreground">{costLabel(detectModel, isDemo(detectModel))}</p>
- {detect?.result?.status === "succeeded" && loadedFor === detect.id && !rows.length && <p className="text-center text-[12px] text-muted-foreground">No text was found on this image.</p>}
- {detect && isFailed(detect) && <JobState job={detect} failedTitle="Could not read the text on this image." onRetry={startDetect} />}
- </div>
- )
- ) : (
- <p className="rounded-lg bg-muted/70 px-3 py-2 text-[12px] text-muted-foreground">Text detection runs on the cloud engine (Ideogram). On open source, type each line you want to change.</p>
+ {!rows.length && (
+ <div className="space-y-2">
+ {detectorPicker}
+ <Button variant="secondary" className="w-full rounded-full" onClick={() => void startDetect()} disabled={busy || preparing || detecting || !detector.model}>
+ {detecting ? <Loader2 className="animate-spin" /> : <Type />} {detecting ? "Reading the text…" : "Detect text"}
+ </Button>
- <p className="text-center font-mono text-[11px] text-subtle-foreground">{detectCost}</p>
- {detector.model?.engine === "open" && !detecting && <p className="text-center text-[11px] text-pretty text-subtle-foreground">Reads the lines on your ComfyUI: seconds on a GPU, a few minutes on a CPU.</p>}
++ <p className="text-center font-mono text-[11px] text-muted-foreground">{detectCost}</p>
++ {detector.model?.engine === "open" && !detecting && <p className="text-center text-[11px] text-pretty text-muted-foreground">Reads the lines on your ComfyUI: seconds on a GPU, a few minutes on a CPU.</p>}
+ {detecting && <JobState job={detect} />}
+ {found && !rows.length && (
+ <p className="text-center text-[12px] text-muted-foreground" role="status">
+ {unreadable ? "Could not read the text on this image." : "No text was found on this image."}
+ </p>
+ )}
+ {detect && isFailed(detect) && <JobState job={detect} failedTitle="Could not read the text on this image." onRetry={() => void startDetect()} />}
+ {!typing && (
+ <button type="button" className="mx-auto block text-[12px] font-medium text-brand-text hover:underline" onClick={addLine}>
+ Type the lines instead
+ </button>
+ )}
+ </div>
)}
{restored && rows.length > 0 && <p className="text-[11px] text-muted-foreground">Restored from your last detection — the image may have changed since. Re-detect if the regions look off.</p>}
- {(rows.length > 0 || engine === "open") && (
+ {listed && (
<ol className="space-y-2" aria-label="Text on the image">
{rows.map((r, i) => (
<li key={i} className="flex items-start gap-2" onPointerEnter={() => setHighlight(r.box)} onPointerLeave={() => setHighlight(null)} onFocus={() => setHighlight(r.box)} onBlur={() => setHighlight(null)}>
- <span className="mt-2 w-4 shrink-0 text-right font-mono text-[11px] text-subtle-foreground">{i + 1}</span>
+ <span className="mt-2 w-4 shrink-0 text-right font-mono text-[11px] text-muted-foreground">{i + 1}</span>
<div className="min-w-0 flex-1 space-y-1">
- {engine === "open" && !r.box ? (
+ {!r.box ? (
<Input value={r.from} onChange={(e) => setRows(rows.map((x, j) => (j === i ? { ...x, from: e.target.value } : x)))} placeholder="Text on the image now" aria-label={`Text region ${i + 1}: current text`} className="h-8 text-[13px]" />
) : (
<p className="truncate text-[11px] text-muted-foreground" title={r.from}>
diff --cc src/server/providers/comfyui.ts
index 3ca2bb1a,68bd45ee..712c1dc4
--- a/src/server/providers/comfyui.ts
+++ b/src/server/providers/comfyui.ts
@@@ -43,11 -33,10 +43,12 @@@ import { getMaker, makerPrompt, OPEN_TA
import { CLICK_OPEN_PROBLEM, HAND_OFF, REMOVE_SCENE, targetPhrase } from "@/lib/catalog/remove-object";
import type { GenInput, MediaKind, ModelRoute, Operation } from "@/lib/catalog/types";
import { probeMedia, type MediaInfo } from "@/lib/media-probe";
+ import { ocrText, parseOcrFrame, parseOcrLines, type OcrFrame } from "@/lib/ocr";
import { getSetting, isCandidate, savedSetting } from "../settings";
import { decodePng, encodePng } from "../png";
-import { readRef } from "../storage";
+import { probeWebm } from "../webm-probe";
+import { adoptFile, readRef, scratchDir } from "../storage";
+import { zipToFile } from "../zip";
import { ProviderError, type ProviderAdapter, type RemoteOutput } from "./types";
export const WORKFLOW_DIR = path.join(process.cwd(), "workflows", "comfyui");