Spaces:
Sleeping
Sleeping
added text streamer
Browse files- backend.py +3 -5
backend.py
CHANGED
@@ -41,14 +41,13 @@ parser = SentenceSplitter.from_defaults(
|
|
41 |
chunk_size=256, chunk_overlap=64, paragraph_separator="\n\n"
|
42 |
)
|
43 |
|
44 |
-
@spaces.GPU(duration=20)
|
45 |
def build_index():
|
46 |
# Load documents from a file
|
47 |
-
documents = SimpleDirectoryReader(input_files=["data/blockchainprova.txt"]).load_data()
|
48 |
# Parse the documents into nodes
|
49 |
-
nodes = parser.get_nodes_from_documents(documents)
|
50 |
# Build the vector store index from the nodes
|
51 |
-
index = VectorStoreIndex(nodes)
|
52 |
|
53 |
return index
|
54 |
|
@@ -58,7 +57,6 @@ index = build_index()
|
|
58 |
@spaces.GPU(duration=20)
|
59 |
def handle_query(query_str, chathistory):
|
60 |
|
61 |
-
|
62 |
|
63 |
qa_prompt_str = (
|
64 |
"Context information is below.\n"
|
|
|
41 |
chunk_size=256, chunk_overlap=64, paragraph_separator="\n\n"
|
42 |
)
|
43 |
|
|
|
44 |
def build_index():
|
45 |
# Load documents from a file
|
46 |
+
documents = SimpleDirectoryReader(input_files=["data/blockchainprova.txt"]).load_data().
|
47 |
# Parse the documents into nodes
|
48 |
+
nodes = parser.get_nodes_from_documents(documents).
|
49 |
# Build the vector store index from the nodes
|
50 |
+
index = VectorStoreIndex(nodes).
|
51 |
|
52 |
return index
|
53 |
|
|
|
57 |
@spaces.GPU(duration=20)
|
58 |
def handle_query(query_str, chathistory):
|
59 |
|
|
|
60 |
|
61 |
qa_prompt_str = (
|
62 |
"Context information is below.\n"
|