Spaces:
Sleeping
Sleeping
import streamlit as st | |
# Page Config | |
st.set_page_config(layout="wide") | |
# Sidebar with Example Questions | |
st.sidebar.title("Example Questions") | |
st.sidebar.write("- What is AI?") | |
st.sidebar.write("- How does deep learning work?") | |
st.sidebar.write("- What are transformers in NLP?") | |
st.sidebar.write("Recent Queries:") | |
st.sidebar.write("- Explain LLMs") | |
st.sidebar.write("- Applications of GANs") | |
# Centered Title | |
st.markdown("<h1 style='text-align: center;'>Query Processing App</h1>", unsafe_allow_html=True) | |
# Layout | |
left_col, right_col = st.columns([2, 2]) # Equal width for left and right sections | |
# Left Side - Query Input & Response | |
with left_col: | |
st.markdown("<div style='border:2px solid #ddd; padding:15px; border-radius:10px;'>", unsafe_allow_html=True) | |
st.subheader("Enter your Query") | |
query = st.text_area("Query:", height=100, key="query_input") | |
col1, col2 = st.columns([1, 1]) | |
with col1: | |
if st.button("Submit"): | |
st.session_state.response = "Sample Response: Processed Query" | |
st.session_state.retrieved_docs = "Sample Retrieved Documents" | |
st.session_state.metrics = "Sample Metrics: Accuracy 95%" | |
with col2: | |
if st.button("Clear"): | |
st.session_state.query_input = "" | |
st.session_state.response = "" | |
st.session_state.retrieved_docs = "" | |
st.session_state.metrics = "" | |
st.subheader("Response") | |
st.text_area("Response:", value=st.session_state.get("response", ""), height=100, key="response_box", disabled=True) | |
st.markdown("</div>", unsafe_allow_html=True) | |
# Right Side - Retrieved Documents | |
with right_col: | |
st.markdown("<div style='border:2px solid #ddd; padding:15px; border-radius:10px; height:100%;'>", unsafe_allow_html=True) | |
if st.button("Show Retrieved Documents"): | |
st.session_state.retrieved_docs = "Sample Retrieved Documents" | |
st.subheader("Retrieved Documents") | |
st.text_area("Retrieved Documents:", value=st.session_state.get("retrieved_docs", ""), height=230, key="docs_box", disabled=True) | |
st.markdown("</div>", unsafe_allow_html=True) | |
# Bottom Section - Metrics | |
st.markdown("<div style='border:2px solid #ddd; padding:15px; border-radius:10px; margin-top:20px;'>", unsafe_allow_html=True) | |
if st.button("Calculate Metrics"): | |
st.session_state.metrics = "Sample Metrics: Accuracy 95%" | |
st.subheader("Metrics") | |
st.text_area("Metrics:", value=st.session_state.get("metrics", ""), height=100, key="metrics_box", disabled=True) | |
st.markdown("</div>", unsafe_allow_html=True) | |