Team Ai
Apppublic

rrreddykonda/Python3-FAQs-Chatbot

sourceHugging Facemitupdated 2y agoView on Hugging Face
1likes
app.py80 linesDownload Raw Back to root
1import streamlit as st2import Rag3 4# Set the page configuration5st.set_page_config(6    page_title="Python FAQs Q&A App",7    page_icon="🐍",8    layout="centered",9    initial_sidebar_state="expanded",10)11 12# Add custom CSS for styling13st.markdown("""14    <style>15        .title {16            font-size: 3em;17            font-weight: bold;18            color: #4CAF50;19            text-align: center;20        }21        .description {22            font-size: 1.2em;23            color: #555555;24            text-align: center;25        }26        .stTextInput > label {27            font-size: 1.2em;28            font-weight: bold;29        }30        .footer {31            visibility: visible;32            position: fixed;33            bottom: 0;34            left: 0;35            width: 100%;36            background-color: #f1f1f1;37            text-align: center;38            padding: 10px;39            font-size: 1em;40            color: #555555;41        }42        .main-content {43            padding-bottom: 70px; /* Space for the footer */44        }45    </style>46    """, unsafe_allow_html=True)47 48# Main content49st.markdown('<div class="title">Python FAQs Question Answering App</div>', unsafe_allow_html=True)50st.markdown("""51    <div class="description">52        Enter your question about Python and get an instant answer! The chatbot is trained on data from the 53        <a href="https://docs.python.org/3/faq/index.html" target="_blank">Python FAQs</a>.54    </div>55    """, unsafe_allow_html=True)56 57# Container for main content to avoid footer overlap58st.markdown('<div class="main-content">', unsafe_allow_html=True)59 60# Input for user query61query = st.text_input("Enter your question:")62 63# Display answer if a query is provided64if query:65    answer = Rag.rag_chain.invoke(query)66    st.markdown("### Answer")67    st.write(answer)68else:69    st.markdown("Please enter a question to get an answer.")70 71# Close the main content container72st.markdown('</div>', unsafe_allow_html=True)73 74# Add a footer75st.markdown("""76    <div class="footer">77        Made with ❤️ in Python by Raghu78    </div>79""", unsafe_allow_html=True)80