Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +42 -0
- requirements.txt +17 -0
app.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
# Streamlit App Title
|
4 |
+
st.title("Query Processing App")
|
5 |
+
|
6 |
+
# Query Input Section
|
7 |
+
st.subheader("Enter your Query")
|
8 |
+
query = st.text_area("Query:", height=100, key="query_input")
|
9 |
+
|
10 |
+
# Buttons in a row
|
11 |
+
col1, col2 = st.columns([1, 1])
|
12 |
+
|
13 |
+
with col1:
|
14 |
+
if st.button("Submit"):
|
15 |
+
st.session_state.response = "Sample Response: Processed Query"
|
16 |
+
st.session_state.retrieved_docs = "Sample Retrieved Documents"
|
17 |
+
st.session_state.metrics = "Sample Metrics: Accuracy 95%"
|
18 |
+
|
19 |
+
with col2:
|
20 |
+
if st.button("Clear"):
|
21 |
+
st.session_state.query_input = ""
|
22 |
+
st.session_state.response = ""
|
23 |
+
st.session_state.retrieved_docs = ""
|
24 |
+
st.session_state.metrics = ""
|
25 |
+
|
26 |
+
# Response Text Box
|
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 Section
|
31 |
+
if st.button("Show Retrieved Documents"):
|
32 |
+
st.session_state.retrieved_docs = "Sample Retrieved Documents"
|
33 |
+
|
34 |
+
st.subheader("Retrieved Documents")
|
35 |
+
st.text_area("Retrieved Documents:", value=st.session_state.get("retrieved_docs", ""), height=100, key="docs_box", disabled=True)
|
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)
|
requirements.txt
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
fastapi
|
2 |
+
uvicorn
|
3 |
+
streamlit
|
4 |
+
faiss-cpu
|
5 |
+
torch
|
6 |
+
transformers
|
7 |
+
sentence-transformers
|
8 |
+
langchain
|
9 |
+
openai
|
10 |
+
chromadb
|
11 |
+
datasets
|
12 |
+
langchain-community
|
13 |
+
rank_bm25
|
14 |
+
nltk
|
15 |
+
requests
|
16 |
+
rouge-score
|
17 |
+
numpy
|