Spaces:
Sleeping
Sleeping
Pratik Dwivedi
commited on
Commit
•
261bad5
1
Parent(s):
c470073
basic chat
Browse files- app.py +25 -0
- requirements.txt +5 -0
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
|
4 |
+
def main():
|
5 |
+
st.title("Health Chatbot")
|
6 |
+
|
7 |
+
st.set_page_config(page_title="Health Chatbot", page_icon="🧊", layout="wide")
|
8 |
+
|
9 |
+
if 'messages' not in st.session_state:
|
10 |
+
st.session_state.messages = []
|
11 |
+
|
12 |
+
# display all the messages already in the session state
|
13 |
+
for message in st.session_state.messages:
|
14 |
+
if message["sender"] == "user":
|
15 |
+
st.write("You: ", message["message"])
|
16 |
+
else:
|
17 |
+
st.write("Bot: ", message["message"])
|
18 |
+
|
19 |
+
user_input = st.chat_input("You", key="user_input")
|
20 |
+
if user_input:
|
21 |
+
st.session_state.messages.append({"sender": "user", "message": user_input})
|
22 |
+
|
23 |
+
|
24 |
+
if __name__ == "__main__":
|
25 |
+
main()
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
langchain
|
3 |
+
langchain_community
|
4 |
+
instructembeddings
|
5 |
+
transformers
|