Skip to content

Commit 9812377

Browse files
committed
fixed code
1 parent d275d52 commit 9812377

8 files changed

Lines changed: 14 additions & 15 deletions

File tree

214 KB
Binary file not shown.

chroma_db/b5613f54-a76f-4ea5-8d6d-b3c7ba46d149/header.bin renamed to chroma_db/b271efe8-6edf-4220-b262-105e8b555b9a/header.bin

File renamed without changes.

chroma_db/b5613f54-a76f-4ea5-8d6d-b3c7ba46d149/length.bin renamed to chroma_db/b271efe8-6edf-4220-b262-105e8b555b9a/length.bin

File renamed without changes.

chroma_db/b5613f54-a76f-4ea5-8d6d-b3c7ba46d149/link_lists.bin renamed to chroma_db/b271efe8-6edf-4220-b262-105e8b555b9a/link_lists.bin

File renamed without changes.
-214 KB
Binary file not shown.

chroma_db/chroma.sqlite3

0 Bytes
Binary file not shown.

index.html

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,12 @@ <h3>5. Visual Capabilities (CLIP + ChromaDB)</h3>
792792
<div class="code-wrapper">
793793
<pre><button class="copy-btn" onclick="copyToClipboard(this)">Copy</button><code class="language-python">from typing import TypedDict, List
794794
import csv
795+
import os
796+
import chromadb
797+
from chromadb.config import Settings
798+
from PIL import Image
799+
from sentence_transformers import SentenceTransformer
800+
import uuid
795801

796802
from langchain_ollama import ChatOllama
797803
from langchain.tools import tool
@@ -873,16 +879,6 @@ <h3>5. Visual Capabilities (CLIP + ChromaDB)</h3>
873879
except Exception as e:
874880
return f"Error: {e}"
875881

876-
877-
import os
878-
import chromadb
879-
from chromadb.config import Settings
880-
from PIL import Image
881-
from sentence_transformers import SentenceTransformer
882-
import uuid
883-
884-
# ... (existing imports) ...
885-
886882
# =========================
887883
# Image Indexing (CLIP + ChromaDB)
888884
# =========================
@@ -893,8 +889,10 @@ <h3>5. Visual Capabilities (CLIP + ChromaDB)</h3>
893889

894890
# Initialize ChromaDB (persistent)
895891
self.client = chromadb.PersistentClient(path="./chroma_db")
896-
self.collection = self.client.get_or_create_collection(name="local_images")
897-
892+
self.collection = self.client.get_or_create_collection(
893+
name="local_images",
894+
metadata={"hnsw:space": "cosine"}
895+
)
898896
# Load CLIP model
899897
print("Loading CLIP model...")
900898
self.model = SentenceTransformer('clip-ViT-B-32')
@@ -1016,7 +1014,6 @@ <h3>5. Visual Capabilities (CLIP + ChromaDB)</h3>
10161014
)
10171015
)
10181016

1019-
10201017
# =========================
10211018
# Graph Nodes
10221019
# =========================

local_agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ def __init__(self, image_dir: str = "images"):
9797

9898
# Initialize ChromaDB (persistent)
9999
self.client = chromadb.PersistentClient(path="./chroma_db")
100-
self.collection = self.client.get_or_create_collection(name="local_images")
101-
100+
self.collection = self.client.get_or_create_collection(
101+
name="local_images",
102+
metadata={"hnsw:space": "cosine"}
103+
)
102104
# Load CLIP model
103105
print("Loading CLIP model...")
104106
self.model = SentenceTransformer('clip-ViT-B-32')

0 commit comments

Comments
 (0)