Spaces:
Sleeping
Sleeping
added introductory prompt
Browse files- backend.py +1 -4
backend.py
CHANGED
@@ -7,8 +7,6 @@ from llama_index.embeddings.instructor import InstructorEmbedding
|
|
7 |
import gradio as gr
|
8 |
from llama_index.core import Settings, VectorStoreIndex, SimpleDirectoryReader, PromptTemplate, load_index_from_storage, StorageContext
|
9 |
from llama_index.core.node_parser import SentenceSplitter
|
10 |
-
from huggingface_hub import hf_hub_download
|
11 |
-
from llama_cpp import Llama
|
12 |
import spaces
|
13 |
from huggingface_hub import login
|
14 |
from llama_index.core.memory import ChatMemoryBuffer
|
@@ -76,7 +74,7 @@ def build_index(path: str):
|
|
76 |
|
77 |
|
78 |
|
79 |
-
@spaces.GPU(duration=
|
80 |
def handle_query(query_str: str,
|
81 |
chat_history: list[tuple[str, str]]) -> Iterator[str]:
|
82 |
|
@@ -90,7 +88,6 @@ def handle_query(query_str: str,
|
|
90 |
]
|
91 |
)
|
92 |
|
93 |
-
|
94 |
if not session_state["index"]:
|
95 |
matched_path = None
|
96 |
words = query_str.lower()
|
|
|
7 |
import gradio as gr
|
8 |
from llama_index.core import Settings, VectorStoreIndex, SimpleDirectoryReader, PromptTemplate, load_index_from_storage, StorageContext
|
9 |
from llama_index.core.node_parser import SentenceSplitter
|
|
|
|
|
10 |
import spaces
|
11 |
from huggingface_hub import login
|
12 |
from llama_index.core.memory import ChatMemoryBuffer
|
|
|
74 |
|
75 |
|
76 |
|
77 |
+
@spaces.GPU(duration=20)
|
78 |
def handle_query(query_str: str,
|
79 |
chat_history: list[tuple[str, str]]) -> Iterator[str]:
|
80 |
|
|
|
88 |
]
|
89 |
)
|
90 |
|
|
|
91 |
if not session_state["index"]:
|
92 |
matched_path = None
|
93 |
words = query_str.lower()
|