Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -1,89 +1,43 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
#
|
4 |
-
st.set_page_config(layout="wide")
|
5 |
|
6 |
-
#
|
7 |
-
st.
|
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 |
-
|
19 |
-
st.markdown(
|
20 |
-
"""
|
21 |
-
<style>
|
22 |
-
.section {
|
23 |
-
border: 2px solid #ddd;
|
24 |
-
border-radius: 10px;
|
25 |
-
padding: 15px;
|
26 |
-
margin-bottom: 10px;
|
27 |
-
background-color: #f9f9f9;
|
28 |
-
height: 100%;
|
29 |
-
}
|
30 |
-
.full-height {
|
31 |
-
display: flex;
|
32 |
-
flex-direction: column;
|
33 |
-
height: 100%;
|
34 |
-
}
|
35 |
-
</style>
|
36 |
-
""",
|
37 |
-
unsafe_allow_html=True,
|
38 |
-
)
|
39 |
|
40 |
-
|
|
|
41 |
|
42 |
-
#
|
43 |
-
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
st.session_state.retrieved_docs = "Sample Retrieved Documents"
|
54 |
-
st.session_state.metrics = "Sample Metrics: Accuracy 95%"
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
st.session_state.query_input = ""
|
59 |
-
st.session_state.response = ""
|
60 |
-
st.session_state.retrieved_docs = ""
|
61 |
-
st.session_state.metrics = ""
|
62 |
|
63 |
-
|
64 |
-
|
65 |
|
66 |
-
|
|
|
|
|
67 |
|
68 |
-
#
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
if st.button("Show Retrieved Documents"):
|
73 |
-
st.session_state.retrieved_docs = "Sample Retrieved Documents"
|
74 |
-
|
75 |
-
st.subheader("Retrieved Documents")
|
76 |
-
st.text_area("Retrieved Documents:", value=st.session_state.get("retrieved_docs", ""), height=230, key="docs_box", disabled=True)
|
77 |
-
|
78 |
-
st.markdown("</div>", unsafe_allow_html=True) # Closing border div
|
79 |
-
|
80 |
-
# Bottom Section - Metrics
|
81 |
-
st.markdown("<div class='section' style='text-align:center;'>", unsafe_allow_html=True)
|
82 |
-
|
83 |
-
if st.button("Calculate Metrics"):
|
84 |
-
st.session_state.metrics = "Sample Metrics: Accuracy 95%"
|
85 |
-
|
86 |
-
st.subheader("Metrics")
|
87 |
-
st.text_area("Metrics:", value=st.session_state.get("metrics", ""), height=100, key="metrics_box", disabled=True)
|
88 |
-
|
89 |
-
st.markdown("</div>", unsafe_allow_html=True) # Closing border div
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
# Set page title
|
4 |
+
st.set_page_config(page_title="RAG7 - Real Time RAG System", layout="wide")
|
5 |
|
6 |
+
# Title and description
|
7 |
+
st.markdown("## RAG7 - Real World RAG System ")
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
|
|
|
|
9 |
|
10 |
+
st.markdown("### Hi, What do you want to know today? ")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
# User input field
|
13 |
+
question = st.text_input("Please Enter Your Query.", placeholder="Type your question here")
|
14 |
|
15 |
+
# Example questions (as buttons)
|
16 |
+
st.markdown("**Try these examples:**")
|
17 |
+
col1, col2, col3 = st.columns(3)
|
18 |
|
19 |
+
if col1.button("When was the first case of COVID-19 identified?"):
|
20 |
+
question = "When was the first case of COVID-19 identified?"
|
21 |
+
if col2.button("Explain the concept of blockchain."):
|
22 |
+
question = "Explain the concept of blockchain."
|
23 |
+
if col3.button("What is the capital of France?"):
|
24 |
+
question = "What is the capital of France?"
|
25 |
|
26 |
+
# Submit & Clear buttons
|
27 |
+
col1, col2 = st.columns([1, 1])
|
28 |
+
submit = col1.button("Submit")
|
29 |
+
clear = col2.button("Clear")
|
|
|
|
|
30 |
|
31 |
+
if clear:
|
32 |
+
question = ""
|
|
|
|
|
|
|
|
|
33 |
|
34 |
+
# Response area
|
35 |
+
st.text_area("Response", value="(Your answer will appear here)", height=100, disabled=True)
|
36 |
|
37 |
+
# Compute Metrics Button
|
38 |
+
st.markdown("---")
|
39 |
+
compute_metrics = st.button("Compute Metrics")
|
40 |
|
41 |
+
# Attributes & Metrics sections
|
42 |
+
st.text_area("Attributes", value="", height=80, disabled=True)
|
43 |
+
st.text_area("Metrics", value="", height=80, disabled=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|