Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,11 +13,13 @@ import chromadb
|
|
| 13 |
app = FastAPI()
|
| 14 |
client = chromadb.PersistentClient(path="/data/chroma_db")
|
| 15 |
collection = client.get_or_create_collection(name="knowledge_base")
|
|
|
|
| 16 |
pdf_file="Sutures and Suturing techniques.pdf"
|
| 17 |
pptx_file="impalnt 1.pptx"
|
| 18 |
|
| 19 |
|
| 20 |
collection = client.get_collection(name="knowledge_base")
|
|
|
|
| 21 |
|
| 22 |
# Initialize models
|
| 23 |
text_model = SentenceTransformer('all-MiniLM-L6-v2')
|
|
@@ -100,6 +102,7 @@ def store_data(texts, image_paths):
|
|
| 100 |
# Store text embeddings
|
| 101 |
for i, text in enumerate(texts):
|
| 102 |
text_embedding = get_text_embedding(text)
|
|
|
|
| 103 |
collection.add(ids=[f"text_{i}"], embeddings=[text_embedding], documents=[text])
|
| 104 |
|
| 105 |
# Store image embeddings
|
|
|
|
| 13 |
app = FastAPI()
|
| 14 |
client = chromadb.PersistentClient(path="/data/chroma_db")
|
| 15 |
collection = client.get_or_create_collection(name="knowledge_base")
|
| 16 |
+
|
| 17 |
pdf_file="Sutures and Suturing techniques.pdf"
|
| 18 |
pptx_file="impalnt 1.pptx"
|
| 19 |
|
| 20 |
|
| 21 |
collection = client.get_collection(name="knowledge_base")
|
| 22 |
+
print("Collection Embedding Dimension:", collection.metadata)
|
| 23 |
|
| 24 |
# Initialize models
|
| 25 |
text_model = SentenceTransformer('all-MiniLM-L6-v2')
|
|
|
|
| 102 |
# Store text embeddings
|
| 103 |
for i, text in enumerate(texts):
|
| 104 |
text_embedding = get_text_embedding(text)
|
| 105 |
+
print("Embedding Dimension:", len(text_embedding))
|
| 106 |
collection.add(ids=[f"text_{i}"], embeddings=[text_embedding], documents=[text])
|
| 107 |
|
| 108 |
# Store image embeddings
|