Update app.py
Browse files
app.py
CHANGED
@@ -7,26 +7,27 @@ import os
|
|
7 |
import streamlit as st
|
8 |
from PIL import Image
|
9 |
|
10 |
-
corpus_ids = str(os.environ['corpus_ids']).split(',')
|
11 |
-
questions = list(eval(os.environ['examples']))
|
12 |
-
|
13 |
-
cfg = OmegaConf.create({
|
14 |
-
'customer_id': str(os.environ['customer_id']),
|
15 |
-
'corpus_ids': corpus_ids,
|
16 |
-
'api_key': str(os.environ['api_key']),
|
17 |
-
'title': os.environ['title'],
|
18 |
-
'description': os.environ['description'],
|
19 |
-
'examples': questions,
|
20 |
-
'source_data_desc': os.environ['source_data_desc']
|
21 |
-
})
|
22 |
-
|
23 |
-
vq = VectaraQuery(cfg.api_key, cfg.customer_id, cfg.corpus_ids)
|
24 |
|
25 |
def launch_bot():
|
26 |
def generate_response(question):
|
27 |
response = vq.submit_query(question)
|
28 |
return response
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
st.set_page_config(page_title=cfg.title, layout="wide")
|
31 |
|
32 |
# left side content
|
@@ -72,4 +73,5 @@ def launch_bot():
|
|
72 |
st.session_state.messages.append(message)
|
73 |
|
74 |
if __name__ == "__main__":
|
|
|
75 |
launch_bot()
|
|
|
7 |
import streamlit as st
|
8 |
from PIL import Image
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
def launch_bot():
|
12 |
def generate_response(question):
|
13 |
response = vq.submit_query(question)
|
14 |
return response
|
15 |
|
16 |
+
corpus_ids = str(os.environ['corpus_ids']).split(',')
|
17 |
+
questions = list(eval(os.environ['examples']))
|
18 |
+
cfg = OmegaConf.create({
|
19 |
+
'customer_id': str(os.environ['customer_id']),
|
20 |
+
'corpus_ids': corpus_ids,
|
21 |
+
'api_key': str(os.environ['api_key']),
|
22 |
+
'title': os.environ['title'],
|
23 |
+
'description': os.environ['description'],
|
24 |
+
'examples': questions,
|
25 |
+
'source_data_desc': os.environ['source_data_desc']
|
26 |
+
})
|
27 |
+
|
28 |
+
if vq is None:
|
29 |
+
vq = VectaraQuery(cfg.api_key, cfg.customer_id, cfg.corpus_ids)
|
30 |
+
|
31 |
st.set_page_config(page_title=cfg.title, layout="wide")
|
32 |
|
33 |
# left side content
|
|
|
73 |
st.session_state.messages.append(message)
|
74 |
|
75 |
if __name__ == "__main__":
|
76 |
+
vq = None
|
77 |
launch_bot()
|