Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,8 +6,8 @@ from llama_index.llm_predictor.chatgpt import ChatGPTLLMPredictor
|
|
6 |
|
7 |
index_name = "./kion.json"
|
8 |
documents_folder = "./documents"
|
9 |
-
|
10 |
-
|
11 |
def initialize_index(index_name, documents_folder):
|
12 |
#llm_predictor = ChatGPTLLMPredictor()
|
13 |
llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo")) # text-davinci-003"))
|
@@ -22,8 +22,8 @@ def initialize_index(index_name, documents_folder):
|
|
22 |
|
23 |
return index
|
24 |
|
25 |
-
|
26 |
-
|
27 |
def query_index(_index, query_text):
|
28 |
response = _index.query(query_text)
|
29 |
return str(response)
|
@@ -43,7 +43,7 @@ if api_key:
|
|
43 |
if index is None:
|
44 |
st.warning("Please enter your api key first.")
|
45 |
|
46 |
-
text = st.text_input("Query text:", value="What type of
|
47 |
|
48 |
if st.button("Run Query") and text is not None:
|
49 |
response = query_index(index, "Act as a KION equipment expert:" + text)
|
|
|
6 |
|
7 |
index_name = "./kion.json"
|
8 |
documents_folder = "./documents"
|
9 |
+
#@st.experimental_memo
|
10 |
+
#@st.cache_resource
|
11 |
def initialize_index(index_name, documents_folder):
|
12 |
#llm_predictor = ChatGPTLLMPredictor()
|
13 |
llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo")) # text-davinci-003"))
|
|
|
22 |
|
23 |
return index
|
24 |
|
25 |
+
#@st.experimental_memo
|
26 |
+
#@st.cache_data(max_entries=200, persist=True)
|
27 |
def query_index(_index, query_text):
|
28 |
response = _index.query(query_text)
|
29 |
return str(response)
|
|
|
43 |
if index is None:
|
44 |
st.warning("Please enter your api key first.")
|
45 |
|
46 |
+
text = st.text_input("Query text:", value="What type of tires sizes, front, rear the R20 uses?")
|
47 |
|
48 |
if st.button("Run Query") and text is not None:
|
49 |
response = query_index(index, "Act as a KION equipment expert:" + text)
|