i have a computer vision system tied to google’s firestore firebase and we have…
- User
i have a computer vision system tied to google’s firestore firebase and we have developed an app to also display the number of people detected by the cv to the web app and the database for this is google’s firebase firestore. assume that on my CV the uuid for firestore that we placed is “Detections” so in the firestore firebase every person detected is stored on the Detections collection.
this is my svelte web app
this is my .js file for firebase database import { collection, getDocs, onSnapshot } from “firebase/firestore”; import db from “…/auth/firestore” import { writable } from “svelte/store”;
export let people = writable(0)
async function getTotalNumberOfPeople() { let totalCount = [] const querySnapshot = await getDocs(collection(db, “Detections”)); if(querySnapshot){ querySnapshot.forEach((doc) => { totalCount.push(JSON.parse(JSON.stringify(doc.data()))) }) }
return totalCount }
// Set up a realtime listener to update the reactive store whenever there is new data onSnapshot(collection(db, “Detections”), (snapshot) => { people.set(snapshot.size); // updates the people count, snapshot.size gives the current number of documents }, error => { console.error(error); });
getTotalNumberOfPeople().then((out) => { if(out){ people.set(out) } }); setPeople()
export default people
so will my website app display the number of people detected and be reactive for changes as well in real time?
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.