Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -1,42 +1,68 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
#
|
4 |
-
st.
|
5 |
|
6 |
-
#
|
7 |
-
st.
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
#
|
11 |
-
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
st.session_state.query_input = ""
|
22 |
-
st.session_state.response = ""
|
23 |
-
st.session_state.retrieved_docs = ""
|
24 |
-
st.session_state.metrics = ""
|
25 |
|
26 |
-
|
27 |
-
st.subheader("Response")
|
28 |
-
st.text_area("Response:", value=st.session_state.get("response", ""), height=100, key="response_box", disabled=True)
|
29 |
|
30 |
-
# Retrieved Documents
|
31 |
-
|
32 |
-
st.
|
33 |
|
34 |
-
st.
|
35 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
# Metrics Calculation Section
|
38 |
if st.button("Calculate Metrics"):
|
39 |
st.session_state.metrics = "Sample Metrics: Accuracy 95%"
|
40 |
|
41 |
st.subheader("Metrics")
|
42 |
st.text_area("Metrics:", value=st.session_state.get("metrics", ""), height=100, key="metrics_box", disabled=True)
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
# Page Config
|
4 |
+
st.set_page_config(layout="wide")
|
5 |
|
6 |
+
# Sidebar with Example Questions
|
7 |
+
st.sidebar.title("Example Questions")
|
8 |
+
st.sidebar.write("- What is AI?")
|
9 |
+
st.sidebar.write("- How does deep learning work?")
|
10 |
+
st.sidebar.write("- What are transformers in NLP?")
|
11 |
+
st.sidebar.write("Recent Queries:")
|
12 |
+
st.sidebar.write("- Explain LLMs")
|
13 |
+
st.sidebar.write("- Applications of GANs")
|
14 |
|
15 |
+
# Centered Title
|
16 |
+
st.markdown("<h1 style='text-align: center;'>Query Processing App</h1>", unsafe_allow_html=True)
|
17 |
|
18 |
+
# Layout
|
19 |
+
left_col, right_col = st.columns([2, 2]) # Equal width for left and right sections
|
20 |
+
|
21 |
+
# Left Side - Query Input & Response
|
22 |
+
with left_col:
|
23 |
+
st.markdown("<div style='border:2px solid #ddd; padding:15px; border-radius:10px;'>", unsafe_allow_html=True)
|
24 |
+
|
25 |
+
st.subheader("Enter your Query")
|
26 |
+
query = st.text_area("Query:", height=100, key="query_input")
|
27 |
+
|
28 |
+
col1, col2 = st.columns([1, 1])
|
29 |
+
with col1:
|
30 |
+
if st.button("Submit"):
|
31 |
+
st.session_state.response = "Sample Response: Processed Query"
|
32 |
+
st.session_state.retrieved_docs = "Sample Retrieved Documents"
|
33 |
+
st.session_state.metrics = "Sample Metrics: Accuracy 95%"
|
34 |
+
|
35 |
+
with col2:
|
36 |
+
if st.button("Clear"):
|
37 |
+
st.session_state.query_input = ""
|
38 |
+
st.session_state.response = ""
|
39 |
+
st.session_state.retrieved_docs = ""
|
40 |
+
st.session_state.metrics = ""
|
41 |
|
42 |
+
st.subheader("Response")
|
43 |
+
st.text_area("Response:", value=st.session_state.get("response", ""), height=100, key="response_box", disabled=True)
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
|
|
|
|
46 |
|
47 |
+
# Right Side - Retrieved Documents
|
48 |
+
with right_col:
|
49 |
+
st.markdown("<div style='border:2px solid #ddd; padding:15px; border-radius:10px; height:100%;'>", unsafe_allow_html=True)
|
50 |
|
51 |
+
if st.button("Show Retrieved Documents"):
|
52 |
+
st.session_state.retrieved_docs = "Sample Retrieved Documents"
|
53 |
+
|
54 |
+
st.subheader("Retrieved Documents")
|
55 |
+
st.text_area("Retrieved Documents:", value=st.session_state.get("retrieved_docs", ""), height=230, key="docs_box", disabled=True)
|
56 |
+
|
57 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
58 |
+
|
59 |
+
# Bottom Section - Metrics
|
60 |
+
st.markdown("<div style='border:2px solid #ddd; padding:15px; border-radius:10px; margin-top:20px;'>", unsafe_allow_html=True)
|
61 |
|
|
|
62 |
if st.button("Calculate Metrics"):
|
63 |
st.session_state.metrics = "Sample Metrics: Accuracy 95%"
|
64 |
|
65 |
st.subheader("Metrics")
|
66 |
st.text_area("Metrics:", value=st.session_state.get("metrics", ""), height=100, key="metrics_box", disabled=True)
|
67 |
+
|
68 |
+
st.markdown("</div>", unsafe_allow_html=True)
|