Update app.py
Browse files
app.py
CHANGED
|
@@ -103,9 +103,12 @@ def handle_input():
|
|
| 103 |
chat_history = st.session_state["chat_history"]
|
| 104 |
if len(chat_history) == MAX_HISTORY_LENGTH:
|
| 105 |
chat_history = chat_history[:-1]
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
def generate_response(question: str) -> str:
|
| 111 |
return model.predict([question])[0]
|
|
|
|
| 103 |
chat_history = st.session_state["chat_history"]
|
| 104 |
if len(chat_history) == MAX_HISTORY_LENGTH:
|
| 105 |
chat_history = chat_history[:-1]
|
| 106 |
+
|
| 107 |
+
with open('model_saved.pkl', 'rb') as f:
|
| 108 |
+
model = pickle.load(f)
|
| 109 |
+
if not hasattr(model, 'predict'):
|
| 110 |
+
st.error("The loaded model does not have a predict method.")
|
| 111 |
+
return
|
| 112 |
|
| 113 |
def generate_response(question: str) -> str:
|
| 114 |
return model.predict([question])[0]
|