Spaces:
Running
Running
Upload 51 files
Browse files
src/components/MultiSourceCaptioningView.tsx
CHANGED
@@ -64,8 +64,7 @@ function extractAllBoundingBoxes(output: string): { label: string, bbox_2d: numb
|
|
64 |
|
65 |
export default function MultiSourceCaptioningView() {
|
66 |
const [mode, setMode] = useState<Mode>("File");
|
67 |
-
const [videoUrl
|
68 |
-
const [inputUrl, setInputUrl] = useState<string>(EXAMPLE_VIDEO_URL);
|
69 |
const [prompt, setPrompt] = useState<string>(EXAMPLE_PROMPT);
|
70 |
const [processing, setProcessing] = useState(false);
|
71 |
const [error, setError] = useState<string | null>(null);
|
@@ -75,7 +74,6 @@ export default function MultiSourceCaptioningView() {
|
|
75 |
const [videoProcessing, setVideoProcessing] = useState(false);
|
76 |
const [imageProcessed, setImageProcessed] = useState(false);
|
77 |
const [exampleProcessing, setExampleProcessing] = useState(false);
|
78 |
-
const [urlProcessing, setUrlProcessing] = useState(false);
|
79 |
const [debugOutput, setDebugOutput] = useState<string>("");
|
80 |
const [canvasDims, setCanvasDims] = useState<{w:number,h:number}|null>(null);
|
81 |
const [videoDims, setVideoDims] = useState<{w:number,h:number}|null>(null);
|
@@ -230,18 +228,6 @@ export default function MultiSourceCaptioningView() {
|
|
230 |
};
|
231 |
}, [mode, isLoaded, prompt, runInference, webcamActive]);
|
232 |
|
233 |
-
// URL mode: process frames with setInterval
|
234 |
-
useEffect(() => {
|
235 |
-
if (mode !== "URL" || !isLoaded || !urlProcessing) return;
|
236 |
-
let interval: ReturnType<typeof setInterval> | null = null;
|
237 |
-
interval = setInterval(() => {
|
238 |
-
processVideoFrame();
|
239 |
-
}, 1000);
|
240 |
-
return () => {
|
241 |
-
if (interval) clearInterval(interval);
|
242 |
-
};
|
243 |
-
}, [mode, isLoaded, prompt, runInference, urlProcessing]);
|
244 |
-
|
245 |
// File video mode: process frames with setInterval
|
246 |
useEffect(() => {
|
247 |
if (mode !== "File" || !isLoaded || !uploadedFile || !isVideoFile(uploadedFile) || !videoProcessing) return;
|
@@ -314,11 +300,6 @@ export default function MultiSourceCaptioningView() {
|
|
314 |
setExampleProcessing((prev) => !prev);
|
315 |
};
|
316 |
|
317 |
-
// Handle start/stop for URL video processing
|
318 |
-
const handleToggleUrlProcessing = () => {
|
319 |
-
setUrlProcessing((prev) => !prev);
|
320 |
-
};
|
321 |
-
|
322 |
// Test draw box function
|
323 |
const handleTestDrawBox = () => {
|
324 |
if (!canvasRef.current) return;
|
|
|
64 |
|
65 |
export default function MultiSourceCaptioningView() {
|
66 |
const [mode, setMode] = useState<Mode>("File");
|
67 |
+
const [videoUrl] = useState<string>(EXAMPLE_VIDEO_URL);
|
|
|
68 |
const [prompt, setPrompt] = useState<string>(EXAMPLE_PROMPT);
|
69 |
const [processing, setProcessing] = useState(false);
|
70 |
const [error, setError] = useState<string | null>(null);
|
|
|
74 |
const [videoProcessing, setVideoProcessing] = useState(false);
|
75 |
const [imageProcessed, setImageProcessed] = useState(false);
|
76 |
const [exampleProcessing, setExampleProcessing] = useState(false);
|
|
|
77 |
const [debugOutput, setDebugOutput] = useState<string>("");
|
78 |
const [canvasDims, setCanvasDims] = useState<{w:number,h:number}|null>(null);
|
79 |
const [videoDims, setVideoDims] = useState<{w:number,h:number}|null>(null);
|
|
|
228 |
};
|
229 |
}, [mode, isLoaded, prompt, runInference, webcamActive]);
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
// File video mode: process frames with setInterval
|
232 |
useEffect(() => {
|
233 |
if (mode !== "File" || !isLoaded || !uploadedFile || !isVideoFile(uploadedFile) || !videoProcessing) return;
|
|
|
300 |
setExampleProcessing((prev) => !prev);
|
301 |
};
|
302 |
|
|
|
|
|
|
|
|
|
|
|
303 |
// Test draw box function
|
304 |
const handleTestDrawBox = () => {
|
305 |
if (!canvasRef.current) return;
|