svummidi commited on
Commit
67a8e2a
1 Parent(s): c6287f2

Upload create_index.py

Browse files

Added create index script also

Files changed (1) hide show
  1. create_index.py +17 -0
create_index.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader
2
+ from pathlib import Path
3
+ from llama_index import download_loader
4
+ import os
5
+
6
+
7
+
8
+ os.environ["OPENAI_API_KEY"] = "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"
9
+
10
+
11
+ PandasCSVReader = download_loader("PandasCSVReader")
12
+
13
+ loader = PandasCSVReader()
14
+ documents = loader.load_data(file=Path('./input.csv'))
15
+
16
+ index = GPTSimpleVectorIndex(documents)
17
+ index.save_to_disk('./output.json')