Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ def local_query(query, context):
|
|
45 |
|
46 |
def run_query(history, query):
|
47 |
|
48 |
-
|
49 |
loader = PDFMinerLoader(pdf_filename)
|
50 |
doc = loader.load()
|
51 |
|
@@ -76,32 +76,32 @@ def run_query(history, query):
|
|
76 |
return history, result
|
77 |
|
78 |
|
79 |
-
def load_document(pdf_filename):
|
80 |
|
81 |
|
82 |
-
|
83 |
-
|
84 |
|
85 |
-
|
86 |
-
|
87 |
|
88 |
-
|
89 |
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
|
95 |
-
|
96 |
-
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
|
104 |
-
|
105 |
|
106 |
|
107 |
|
|
|
45 |
|
46 |
def run_query(history, query):
|
47 |
|
48 |
+
# pdf file name input olarak verip, buraya upload event olarak gondermem gereki rmi
|
49 |
loader = PDFMinerLoader(pdf_filename)
|
50 |
doc = loader.load()
|
51 |
|
|
|
76 |
return history, result
|
77 |
|
78 |
|
79 |
+
# def load_document(pdf_filename):
|
80 |
|
81 |
|
82 |
+
# loader = PDFMinerLoader(pdf_filename)
|
83 |
+
# doc = loader.load()
|
84 |
|
85 |
+
# text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
|
86 |
+
# texts = text_splitter.split_documents(doc)
|
87 |
|
88 |
+
# texts = [i.page_content for i in texts]
|
89 |
|
90 |
+
# doc_emb = st_model.encode(texts)
|
91 |
+
# doc_emb = doc_emb.tolist()
|
92 |
|
93 |
+
# ids = [str(uuid.uuid1()) for _ in doc_emb]
|
94 |
|
95 |
+
# client = chromadb.Client()
|
96 |
+
# collection = client.create_collection("test_db")
|
97 |
|
98 |
+
# collection.add(
|
99 |
+
# embeddings=doc_emb,
|
100 |
+
# documents=texts,
|
101 |
+
# ids=ids
|
102 |
+
# )
|
103 |
|
104 |
+
# return 'Success'
|
105 |
|
106 |
|
107 |
|