Spaces:
Sleeping
Sleeping
Commit
·
5fc0bcd
1
Parent(s):
bdb8652
fixint TA page reloading after some time, deleting unnecessary time sleep
Browse files- pages/training_adherence.py +5 -10
pages/training_adherence.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
import numpy as np
|
3 |
from collections import defaultdict
|
@@ -8,8 +9,9 @@ from models.ta_models.config import QUESTION2PHASE, NAME2QUESTION, TA_OPTIONS
|
|
8 |
|
9 |
st.set_page_config(page_title="Conversation Simulator - Scoring")
|
10 |
|
11 |
-
if
|
12 |
-
|
|
|
13 |
|
14 |
if "memory" not in st.session_state:
|
15 |
st.switch_page("pages/convosim.py")
|
@@ -22,19 +24,12 @@ def get_ta_responses():
|
|
22 |
my_bar = st.progress(0, text=progress_text)
|
23 |
data = defaultdict(defaultdict)
|
24 |
for i, question in enumerate(QUESTION2PHASE.keys()):
|
25 |
-
# responses = ["Yes, The helper showed some respect.",
|
26 |
-
# "Yes. The helper is good! No doubt",
|
27 |
-
# "N/A, Texter disengaged.",
|
28 |
-
# "No. While texter is trying is lacking.",
|
29 |
-
# "No \n\n This is an explanation."]
|
30 |
-
# full_response = np.random.choice(responses)
|
31 |
full_convo, prompt, full_response = TA_predict_convo(memory, question, make_explanation=True, conversation_id=st.session_state['convo_id'])
|
32 |
response, explanation = post_process_response(full_response)
|
33 |
data[question]["response"] = response
|
34 |
data[question]["explanation"] = explanation
|
35 |
my_bar.progress((i+1) / len(QUESTION2PHASE.keys()), text = progress_text)
|
36 |
-
|
37 |
-
time.sleep(2)
|
38 |
my_bar.empty()
|
39 |
return data
|
40 |
|
|
|
1 |
+
import time
|
2 |
import streamlit as st
|
3 |
import numpy as np
|
4 |
from collections import defaultdict
|
|
|
9 |
|
10 |
st.set_page_config(page_title="Conversation Simulator - Scoring")
|
11 |
|
12 |
+
if time.time() - st.session_state['last_message_ts'] > 2400: # > 40 min
|
13 |
+
if not are_models_alive():
|
14 |
+
st.switch_page("pages/model_loader.py")
|
15 |
|
16 |
if "memory" not in st.session_state:
|
17 |
st.switch_page("pages/convosim.py")
|
|
|
24 |
my_bar = st.progress(0, text=progress_text)
|
25 |
data = defaultdict(defaultdict)
|
26 |
for i, question in enumerate(QUESTION2PHASE.keys()):
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
full_convo, prompt, full_response = TA_predict_convo(memory, question, make_explanation=True, conversation_id=st.session_state['convo_id'])
|
28 |
response, explanation = post_process_response(full_response)
|
29 |
data[question]["response"] = response
|
30 |
data[question]["explanation"] = explanation
|
31 |
my_bar.progress((i+1) / len(QUESTION2PHASE.keys()), text = progress_text)
|
32 |
+
# time.sleep(2)
|
|
|
33 |
my_bar.empty()
|
34 |
return data
|
35 |
|