beryamosta commited on
Commit
35f2c6f
·
verified ·
1 Parent(s): 81d69ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -24
app.py CHANGED
@@ -1,31 +1,30 @@
1
  import streamlit as st
2
  import random
3
  import time
 
4
 
5
  st.title("Metropole ChatBot pour les Signataire !!")
6
  #_______________________________________________________________________________________________________________________________________________
7
- with st.form("my_form"):
8
 
9
-
10
- # Initialize chat history
11
- if "messages" not in st.session_state:
12
- st.session_state.messages = []
13
-
14
- # Display chat messages from history on app rerun
15
- for message in st.session_state.messages:
16
- with st.chat_message(message["role"]):
17
- st.markdown(message["content"])
18
-
19
- # Accept user input
20
- if prompt := st.chat_input("Que pouis-je vous aider"):
21
- # Add user message to chat history
22
- st.session_state.messages.append({"role": "user", "content": prompt})
23
- # Display user message in chat message container
24
- with st.chat_message("user"):
25
- st.markdown(prompt)
26
-
27
- # Display assistant response in chat message container
28
- with st.chat_message("assistant"):
29
- response = st.write_stream(prompt_objectif(prompt))
30
- # Add assistant response to chat history
31
- st.session_state.messages.append({"role": "assistant", "content": response})
 
1
  import streamlit as st
2
  import random
3
  import time
4
+ import prompt_objectif from backend.py
5
 
6
  st.title("Metropole ChatBot pour les Signataire !!")
7
  #_______________________________________________________________________________________________________________________________________________
 
8
 
9
+ # Initialize chat history
10
+ if "messages" not in st.session_state:
11
+ st.session_state.messages = []
12
+
13
+ # Display chat messages from history on app rerun
14
+ for message in st.session_state.messages:
15
+ with st.chat_message(message["role"]):
16
+ st.markdown(message["content"])
17
+
18
+ # Accept user input
19
+ if prompt := st.chat_input("Que pouis-je vous aider"):
20
+ # Add user message to chat history
21
+ st.session_state.messages.append({"role": "user", "content": prompt})
22
+ # Display user message in chat message container
23
+ with st.chat_message("user"):
24
+ st.markdown(prompt)
25
+
26
+ # Display assistant response in chat message container
27
+ with st.chat_message("assistant"):
28
+ response = st.write_stream(prompt_objectif(prompt))
29
+ # Add assistant response to chat history
30
+ st.session_state.messages.append({"role": "assistant", "content": response})