Update app.py
Browse files
app.py
CHANGED
|
@@ -76,8 +76,8 @@ st.markdown("""
|
|
| 76 |
# Load the model outside the handle_input() function
|
| 77 |
with open('model_saved.pkl', 'rb') as f:
|
| 78 |
model = pickle.load(f)
|
| 79 |
-
if not
|
| 80 |
-
st.error("The loaded model
|
| 81 |
|
| 82 |
def write_top_bar():
|
| 83 |
col1, col2, col3 = st.columns([1,10,2])
|
|
@@ -110,11 +110,8 @@ def handle_input():
|
|
| 110 |
if len(chat_history) == MAX_HISTORY_LENGTH:
|
| 111 |
chat_history = chat_history[:-1]
|
| 112 |
|
| 113 |
-
def generate_response(question: str) -> str:
|
| 114 |
-
return model.predict([question])[0]
|
| 115 |
-
|
| 116 |
prompt = input
|
| 117 |
-
answer =
|
| 118 |
|
| 119 |
chat_history.append((input, answer))
|
| 120 |
|
|
|
|
| 76 |
# Load the model outside the handle_input() function
|
| 77 |
with open('model_saved.pkl', 'rb') as f:
|
| 78 |
model = pickle.load(f)
|
| 79 |
+
if not isinstance(model, str):
|
| 80 |
+
st.error("The loaded model is not valid.")
|
| 81 |
|
| 82 |
def write_top_bar():
|
| 83 |
col1, col2, col3 = st.columns([1,10,2])
|
|
|
|
| 110 |
if len(chat_history) == MAX_HISTORY_LENGTH:
|
| 111 |
chat_history = chat_history[:-1]
|
| 112 |
|
|
|
|
|
|
|
|
|
|
| 113 |
prompt = input
|
| 114 |
+
answer = model # Replace the predict() method with the model itself
|
| 115 |
|
| 116 |
chat_history.append((input, answer))
|
| 117 |
|