Update app.py
Browse files
app.py
CHANGED
@@ -7,10 +7,7 @@ logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
|
|
7 |
|
8 |
GOOGLE_API_KEY = "AIzaSyDYhyRoOWBJWOb4bqY5wmFLrBo4HTwQDko" # add your GOOGLE API key here
|
9 |
os.environ["GOOGLE_API_KEY"] = GOOGLE_API_KEY
|
10 |
-
|
11 |
-
nest_asyncio.apply()
|
12 |
-
|
13 |
-
from llama_parse import LlamaParse
|
14 |
from llama_index.core import SimpleDirectoryReader
|
15 |
from g4f import Provider, models
|
16 |
from langchain.llms.base import LLM
|
@@ -50,7 +47,7 @@ Settings.embed_model = embed_model
|
|
50 |
# Reads pdfs at "./" path
|
51 |
|
52 |
|
53 |
-
|
54 |
parser = LlamaParse(
|
55 |
api_key="llx-KMCDGpt3Yn89wwOYJXaFDfJLHTbUQbnTKVccaGVHJLfAN96w", # can also be set in your env as LLAMA_CLOUD_API_KEY
|
56 |
result_type="markdown", # "markdown" and "text" are available
|
@@ -60,16 +57,16 @@ parser = LlamaParse(
|
|
60 |
file_extractor = {".pdf": parser}
|
61 |
documents = SimpleDirectoryReader("./data", file_extractor=file_extractor).load_data()
|
62 |
|
63 |
-
|
64 |
"""
|
65 |
|
|
|
66 |
documents = (
|
67 |
SimpleDirectoryReader(
|
68 |
input_dir = 'data',
|
69 |
required_exts = [".pdf"])
|
70 |
.load_data()
|
71 |
)
|
72 |
-
|
73 |
# ServiceContext is a bundle of commonly used
|
74 |
# resources used during the indexing and
|
75 |
# querying stage
|
|
|
7 |
|
8 |
GOOGLE_API_KEY = "AIzaSyDYhyRoOWBJWOb4bqY5wmFLrBo4HTwQDko" # add your GOOGLE API key here
|
9 |
os.environ["GOOGLE_API_KEY"] = GOOGLE_API_KEY
|
10 |
+
|
|
|
|
|
|
|
11 |
from llama_index.core import SimpleDirectoryReader
|
12 |
from g4f import Provider, models
|
13 |
from langchain.llms.base import LLM
|
|
|
47 |
# Reads pdfs at "./" path
|
48 |
|
49 |
|
50 |
+
"""
|
51 |
parser = LlamaParse(
|
52 |
api_key="llx-KMCDGpt3Yn89wwOYJXaFDfJLHTbUQbnTKVccaGVHJLfAN96w", # can also be set in your env as LLAMA_CLOUD_API_KEY
|
53 |
result_type="markdown", # "markdown" and "text" are available
|
|
|
57 |
file_extractor = {".pdf": parser}
|
58 |
documents = SimpleDirectoryReader("./data", file_extractor=file_extractor).load_data()
|
59 |
|
|
|
60 |
"""
|
61 |
|
62 |
+
|
63 |
documents = (
|
64 |
SimpleDirectoryReader(
|
65 |
input_dir = 'data',
|
66 |
required_exts = [".pdf"])
|
67 |
.load_data()
|
68 |
)
|
69 |
+
|
70 |
# ServiceContext is a bundle of commonly used
|
71 |
# resources used during the indexing and
|
72 |
# querying stage
|