Manikanta3776 commited on
Commit
0491571
·
verified ·
1 Parent(s): f9c72cb

Update portfolio.py

Browse files
Files changed (1) hide show
  1. portfolio.py +21 -21
portfolio.py CHANGED
@@ -1,21 +1,21 @@
1
- import pandas as pd
2
- import chromadb
3
- import uuid
4
-
5
-
6
- class Portfolio:
7
- def __init__(self, file_path="app/resource/my_portfolio.csv"):
8
- self.file_path = file_path
9
- self.data = pd.read_csv(file_path)
10
- self.chroma_client = chromadb.PersistentClient('vectorstore')
11
- self.collection = self.chroma_client.get_or_create_collection(name="portfolio")
12
-
13
- def load_portfolio(self):
14
- if not self.collection.count():
15
- for _, row in self.data.iterrows():
16
- self.collection.add(documents=row["Techstack"],
17
- metadatas={"links": row["Links"]},
18
- ids=[str(uuid.uuid4())])
19
-
20
- def query_links(self, skills):
21
- return self.collection.query(query_texts=skills, n_results=2).get('metadatas', [])
 
1
+ import pandas as pd
2
+ import chromadb
3
+ import uuid
4
+
5
+
6
+ class Portfolio:
7
+ def __init__(self, file_path="resource/my_portfolio.csv"):
8
+ self.file_path = file_path
9
+ self.data = pd.read_csv(file_path)
10
+ self.chroma_client = chromadb.PersistentClient('vectorstore')
11
+ self.collection = self.chroma_client.get_or_create_collection(name="portfolio")
12
+
13
+ def load_portfolio(self):
14
+ if not self.collection.count():
15
+ for _, row in self.data.iterrows():
16
+ self.collection.add(documents=row["Techstack"],
17
+ metadatas={"links": row["Links"]},
18
+ ids=[str(uuid.uuid4())])
19
+
20
+ def query_links(self, skills):
21
+ return self.collection.query(query_texts=skills, n_results=2).get('metadatas', [])