mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 07:35:27 +03:00
drop and recreate tables on reindex
This commit is contained in:
parent
010d204b43
commit
c87bdb4d26
@ -150,6 +150,14 @@ class Embeddings:
|
|||||||
);
|
);
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
def _drop_tables(self):
|
||||||
|
self.db.execute_sql("""
|
||||||
|
DROP TABLE vec_descriptions;
|
||||||
|
""")
|
||||||
|
self.db.execute_sql("""
|
||||||
|
DROP TABLE vec_thumbnails;
|
||||||
|
""")
|
||||||
|
|
||||||
def upsert_thumbnail(self, event_id: str, thumbnail: bytes):
|
def upsert_thumbnail(self, event_id: str, thumbnail: bytes):
|
||||||
# Convert thumbnail bytes to PIL Image
|
# Convert thumbnail bytes to PIL Image
|
||||||
image = Image.open(io.BytesIO(thumbnail)).convert("RGB")
|
image = Image.open(io.BytesIO(thumbnail)).convert("RGB")
|
||||||
@ -281,6 +289,9 @@ class Embeddings:
|
|||||||
def reindex(self) -> None:
|
def reindex(self) -> None:
|
||||||
logger.info("Indexing event embeddings...")
|
logger.info("Indexing event embeddings...")
|
||||||
|
|
||||||
|
self._drop_tables()
|
||||||
|
self._create_tables()
|
||||||
|
|
||||||
st = time.time()
|
st = time.time()
|
||||||
totals = {
|
totals = {
|
||||||
"thumb": 0,
|
"thumb": 0,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user