ashok2216 commited on
Commit
7ce4952
·
verified ·
1 Parent(s): 1f3c994

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -5,7 +5,7 @@ from huggingface_hub import InferenceClient
5
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
6
 
7
  # Streamlit app configuration
8
- st.set_page_config(page_title="Health Care ChatBot", layout="wide")
9
  st.title("Health Care ChatBot")
10
 
11
  # Initialize session state for messages if not present
@@ -50,24 +50,24 @@ with st.sidebar:
50
  top_p = st.slider("Top-p (nucleus sampling)", 0.1, 1.0, 0.95)
51
 
52
  # Display chat messages from history
53
- # for message in st.session_state.messages:
54
- # if message["role"] == "user":
55
- # # User message on the right
56
- # col1, col2 = st.columns([1, 4])
57
- # with col2:
58
- # with st.chat_message("user"):
59
- # st.write(message["content"])
60
- # with col1:
61
- # st.write("") # Empty space on the left for alignment
62
 
63
- # elif message["role"] == "assistant":
64
- # # Assistant message on the left
65
- # col1, col2 = st.columns([4, 1])
66
- # with col1:
67
- # with st.chat_message("assistant"):
68
- # st.write(message["content"])
69
- # with col2:
70
- # st.write("") # Empty space on the right for alignment
71
 
72
  # Keep user input box at the bottom
73
  st.divider() # Optional, to visually separate chat history from input box
 
5
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
6
 
7
  # Streamlit app configuration
8
+ st.set_page_config(page_title="Health Care ChatBot")
9
  st.title("Health Care ChatBot")
10
 
11
  # Initialize session state for messages if not present
 
50
  top_p = st.slider("Top-p (nucleus sampling)", 0.1, 1.0, 0.95)
51
 
52
  # Display chat messages from history
53
+ for message in st.session_state.messages:
54
+ if message["role"] == "user":
55
+ # User message on the right
56
+ col1, col2 = st.columns([1, 4])
57
+ with col2:
58
+ with st.chat_message("user"):
59
+ st.write(message["content"])
60
+ with col1:
61
+ st.write("") # Empty space on the left for alignment
62
 
63
+ elif message["role"] == "assistant":
64
+ # Assistant message on the left
65
+ col1, col2 = st.columns([4, 1])
66
+ with col1:
67
+ with st.chat_message("assistant"):
68
+ st.write(message["content"])
69
+ with col2:
70
+ st.write("") # Empty space on the right for alignment
71
 
72
  # Keep user input box at the bottom
73
  st.divider() # Optional, to visually separate chat history from input box