-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
52 lines (37 loc) · 1009 Bytes
/
Copy pathapp.py
File metadata and controls
52 lines (37 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import streamlit as st
from chatbot import get_response
st.set_page_config(
page_title="Smart FAQ Assistant",
page_icon="🤖",
layout="wide"
)
st.title("🤖 Smart FAQ Assistant")
st.sidebar.title("About")
st.sidebar.info("""
Topics Covered:
• AI & Machine Learning
• Python Programming
• Computer Science Basics
""")
if "messages" not in st.session_state:
st.session_state.messages = []
if st.sidebar.button("🗑 Clear Chat"):
st.session_state.messages = []
st.rerun()
question = st.text_input(
"Ask your question",
placeholder="Example: What is AI?"
)
if st.button("Send") and question:
answer = get_response(question)
st.session_state.messages.append(
{
"user": question,
"bot": answer
}
)
for msg in reversed(st.session_state.messages):
st.info(f"👤 You: {msg['user']}")
st.success(f"🤖 Bot: {msg['bot']}")
st.markdown("---")
st.caption("Built with Python, Streamlit and Scikit-Learn")