rahgadda commited on
Commit
ae9afb6
·
verified ·
1 Parent(s): feab64a

Initial Draft

Browse files
Files changed (1) hide show
  1. shakesearch.py +12 -17
shakesearch.py CHANGED
@@ -23,25 +23,20 @@ if uploaded_file is not None:
23
  f.write(uploaded_file.getbuffer())
24
 
25
  # Reload documents and index after file upload
26
- documents = SimpleDirectoryReader(input_dir=docs_path, required_exts=[".txt"]).load_data()
27
-
28
- # Debug Script
29
- for i, doc in enumerate(documents):
30
- attributes = [attr for attr in dir(doc) if not attr.startswith("__")] # Filter out private attributes
31
- print(f"Document {i} has the following attributes:")
32
- for attr in attributes:
33
- value = getattr(doc, attr)
34
- print(f"- {attr}: {value}")
35
 
36
- # # Creating embedding
37
- # document_embeddings = [vectorizer(doc.text) for doc in documents]
38
- # nodes = [{"id": doc.name, "text": doc.text} for doc in documents]
39
-
40
- # # Creating Index
41
- # index = VectorStoreIndex(nodes=nodes, document_embeddings=document_embeddings)
42
 
43
- # # Sucess message
44
- # st.success("File uploaded & processed successfully!")
45
 
46
  query = st.text_input("Enter your search query:")
47
 
 
23
  f.write(uploaded_file.getbuffer())
24
 
25
  # Reload documents and index after file upload
26
+ documents = SimpleDirectoryReader(
27
+ input_dir=docs_path,
28
+ filename_as_id=True,
29
+ required_exts=[".txt"]
30
+ ).load_data()
31
+
32
+ # Creating embedding
33
+ document_embeddings = [vectorizer(doc.text) for doc in documents]
 
34
 
35
+ # Creating Index
36
+ index = VectorStoreIndex(nodes=nodes, document_embeddings=document_embeddings)
 
 
 
 
37
 
38
+ # Sucess message
39
+ st.success("File uploaded & processed successfully!")
40
 
41
  query = st.text_input("Enter your search query:")
42