Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
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 |
|