Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,6 @@ from streamlit_extras.add_vertical_space import add_vertical_space
|
|
6 |
from streamlit_mic_recorder import speech_to_text
|
7 |
from model_pipeline import ModelPipeLine
|
8 |
from q_learning_chatbot import QLearningChatbot
|
9 |
-
from model_pipeline.ModelPipeLine import rag_retriever
|
10 |
|
11 |
from gtts import gTTS
|
12 |
from io import BytesIO
|
@@ -18,6 +17,9 @@ st.sidebar.image(image_path, use_column_width=True)
|
|
18 |
st.title('PeacePal 🌱')
|
19 |
|
20 |
mdl = ModelPipeLine()
|
|
|
|
|
|
|
21 |
final_chain = mdl.create_final_chain()
|
22 |
|
23 |
# Define states and actions
|
@@ -128,7 +130,7 @@ with input_container:
|
|
128 |
|
129 |
# Retrieve question
|
130 |
if user_sentiment in ["Negative", "Moderately Negative", "Neutral"]:
|
131 |
-
question =
|
132 |
user_message, predicted_mental_category
|
133 |
)
|
134 |
st.session_state.asked_questions.append(question)
|
@@ -192,7 +194,7 @@ with input_container:
|
|
192 |
|
193 |
# Retrieve question
|
194 |
if user_sentiment in ["Negative", "Moderately Negative", "Neutral"]:
|
195 |
-
question =
|
196 |
user_message, predicted_mental_category
|
197 |
)
|
198 |
st.session_state.asked_questions.append(question)
|
|
|
6 |
from streamlit_mic_recorder import speech_to_text
|
7 |
from model_pipeline import ModelPipeLine
|
8 |
from q_learning_chatbot import QLearningChatbot
|
|
|
9 |
|
10 |
from gtts import gTTS
|
11 |
from io import BytesIO
|
|
|
17 |
st.title('PeacePal 🌱')
|
18 |
|
19 |
mdl = ModelPipeLine()
|
20 |
+
# Now you can access the retriever attribute of the ModelPipeLine instance
|
21 |
+
retriever = mdl.retriever
|
22 |
+
|
23 |
final_chain = mdl.create_final_chain()
|
24 |
|
25 |
# Define states and actions
|
|
|
130 |
|
131 |
# Retrieve question
|
132 |
if user_sentiment in ["Negative", "Moderately Negative", "Neutral"]:
|
133 |
+
question = retriever.get_response(
|
134 |
user_message, predicted_mental_category
|
135 |
)
|
136 |
st.session_state.asked_questions.append(question)
|
|
|
194 |
|
195 |
# Retrieve question
|
196 |
if user_sentiment in ["Negative", "Moderately Negative", "Neutral"]:
|
197 |
+
question = retriever.get_response(
|
198 |
user_message, predicted_mental_category
|
199 |
)
|
200 |
st.session_state.asked_questions.append(question)
|