rbughao commited on
Commit
3d27082
1 Parent(s): 095c739

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,14 +1,16 @@
1
  #for learning
2
  import os
3
  import openai
4
- from google.colab import userdata
5
  import gradio as gr
6
 
7
  openai.api_key = userdata.get('O_APIKey')
8
 
9
  #using a folder
10
- from llama_index import VectorStoreIndex, SimpleDirectoryReader, SummaryIndex
11
- documents = SimpleDirectoryReader('EComm').load_data()
 
 
 
12
  index = VectorStoreIndex.from_documents(documents)
13
  query_engine = index.as_query_engine()
14
 
 
1
  #for learning
2
  import os
3
  import openai
 
4
  import gradio as gr
5
 
6
  openai.api_key = userdata.get('O_APIKey')
7
 
8
  #using a folder
9
+ from llama_index import VectorStoreIndex, SimpleDirectoryReader, SummaryIndex, download_loader
10
+ PDFReader = download_loader("PDFReader")
11
+ loader = PDFReader()
12
+
13
+ documents = loader.load_data(file=Path('toolkit.pdf'))
14
  index = VectorStoreIndex.from_documents(documents)
15
  query_engine = index.as_query_engine()
16