Quazim0t0 commited on
Commit
2bd4486
·
verified ·
1 Parent(s): af73025

Upload 36 files

Browse files
Files changed (1) hide show
  1. src/App.tsx +30 -1
src/App.tsx CHANGED
@@ -1,7 +1,36 @@
1
  import MultiSourceCaptioningView from "./components/MultiSourceCaptioningView";
 
 
2
 
3
  export default function App() {
4
- // Remove all webcam gating logic; just render the main view
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  return (
6
  <div className="App relative h-screen overflow-hidden">
7
  <div className="absolute inset-0 bg-gray-900" />
 
1
  import MultiSourceCaptioningView from "./components/MultiSourceCaptioningView";
2
+ import { useVLMContext } from "./context/useVLMContext";
3
+ import { useState } from "react";
4
 
5
  export default function App() {
6
+ const { isLoaded, isLoading, error, loadModel } = useVLMContext();
7
+ const [started, setStarted] = useState(false);
8
+
9
+ const handleLoadModel = async () => {
10
+ try {
11
+ await loadModel();
12
+ setStarted(true);
13
+ } catch (e) {
14
+ // error is handled by context
15
+ }
16
+ };
17
+
18
+ if (!started || !isLoaded) {
19
+ return (
20
+ <div className="flex flex-col items-center justify-center h-screen bg-gray-900 text-white">
21
+ <h1 className="text-2xl font-bold mb-4">FastVLM WebGPU</h1>
22
+ <button
23
+ className="px-6 py-3 rounded-lg bg-blue-600 text-white font-semibold text-lg mb-4"
24
+ onClick={handleLoadModel}
25
+ disabled={isLoading}
26
+ >
27
+ {isLoading ? "Loading Model..." : "Load Model"}
28
+ </button>
29
+ {error && <div className="text-red-400 mt-2">Model error: {error}</div>}
30
+ </div>
31
+ );
32
+ }
33
+
34
  return (
35
  <div className="App relative h-screen overflow-hidden">
36
  <div className="absolute inset-0 bg-gray-900" />