cb1716pics commited on
Commit
edb7e49
·
verified ·
1 Parent(s): 130e2df

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -76
app.py CHANGED
@@ -1,89 +1,43 @@
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 Structure
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
- left_col, right_col = st.columns([2, 2])
 
41
 
42
- # Left Side - Query Input & Response
43
- with left_col:
44
- st.markdown("<div class='section full-height'>", unsafe_allow_html=True)
45
 
46
- st.subheader("Enter your Query")
47
- query = st.text_area("Query:", height=100, key="query_input")
 
 
 
 
48
 
49
- col1, col2 = st.columns([1, 1])
50
- with col1:
51
- if st.button("Submit"):
52
- st.session_state.response = "Sample Response: Processed Query"
53
- st.session_state.retrieved_docs = "Sample Retrieved Documents"
54
- st.session_state.metrics = "Sample Metrics: Accuracy 95%"
55
 
56
- with col2:
57
- if st.button("Clear"):
58
- st.session_state.query_input = ""
59
- st.session_state.response = ""
60
- st.session_state.retrieved_docs = ""
61
- st.session_state.metrics = ""
62
 
63
- st.subheader("Response")
64
- st.text_area("Response:", value=st.session_state.get("response", ""), height=100, key="response_box", disabled=True)
65
 
66
- st.markdown("</div>", unsafe_allow_html=True) # Closing border div
 
 
67
 
68
- # Right Side - Retrieved Documents
69
- with right_col:
70
- st.markdown("<div class='section full-height'>", unsafe_allow_html=True)
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)