Spaces:
Running
Running
updating the app
Browse files
app.py
CHANGED
@@ -131,14 +131,14 @@ def main():
|
|
131 |
# except KeyError:
|
132 |
# st.error(f"Unexpected response format. Missing 'response_text' key. Received: {response.text}")
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
|
143 |
# Save updated chat history
|
144 |
user_data["chat_history"] = st.session_state.messages
|
|
|
131 |
# except KeyError:
|
132 |
# st.error(f"Unexpected response format. Missing 'response_text' key. Received: {response.text}")
|
133 |
|
134 |
+
if prompt := st.chat_input("What is up?"):
|
135 |
+
response = pipe(f"<s>[INST] {prompt} [/INST]")
|
136 |
+
response_text = response[0]["generated_text"].replace("<s>[INST]", "").replace("[/INST]", "").strip()
|
137 |
+
|
138 |
+
with st.chat_message("assistant"):
|
139 |
+
st.markdown(response_text)
|
140 |
+
|
141 |
+
st.session_state.messages.append({"role": "assistant", "content": response_text})
|
142 |
|
143 |
# Save updated chat history
|
144 |
user_data["chat_history"] = st.session_state.messages
|