Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -31,11 +31,14 @@ if "authenticated" not in st.session_state:
|
|
31 |
|
32 |
# Sidebar
|
33 |
with st.sidebar:
|
34 |
-
# BSNL Logo (local file)
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
39 |
st.header("RAG Control Panel")
|
40 |
api_key_input = st.text_input("Enter RAG Access Key", type="password")
|
41 |
|
@@ -71,25 +74,25 @@ with st.sidebar:
|
|
71 |
|
72 |
# Main app
|
73 |
def main():
|
74 |
-
# Inject CSS for
|
75 |
st.markdown("""
|
76 |
<style>
|
77 |
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
|
78 |
.stApp {
|
79 |
-
background-color: #
|
80 |
font-family: 'Roboto', sans-serif;
|
81 |
-
color: #
|
82 |
}
|
83 |
.stTextInput > div > div > input {
|
84 |
-
background-color: #
|
85 |
color: #333333;
|
86 |
border-radius: 8px;
|
87 |
-
border: 1px solid #
|
88 |
padding: 10px;
|
89 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
90 |
}
|
91 |
.stButton > button {
|
92 |
-
background-color: #
|
93 |
color: white;
|
94 |
border-radius: 8px;
|
95 |
padding: 10px 20px;
|
@@ -98,26 +101,25 @@ def main():
|
|
98 |
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
99 |
}
|
100 |
.stButton > button:hover {
|
101 |
-
background-color: #
|
102 |
transform: scale(1.05);
|
103 |
}
|
104 |
.stSidebar {
|
105 |
-
background-color: #
|
106 |
padding: 20px;
|
107 |
-
border-right: 2px solid #
|
108 |
}
|
109 |
h1, h2, h3 {
|
110 |
-
color: #
|
111 |
-
text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
|
112 |
}
|
113 |
.stSpinner > div > div {
|
114 |
-
border-color: #
|
115 |
}
|
116 |
</style>
|
117 |
""", unsafe_allow_html=True)
|
118 |
|
119 |
-
st.title("
|
120 |
-
st.markdown("Welcome to the BSNL
|
121 |
|
122 |
if not st.session_state.authenticated:
|
123 |
st.warning("Please authenticate with your API key in the sidebar.")
|
@@ -145,6 +147,7 @@ def process_input(input_type, input_data):
|
|
145 |
documents += page.extract_text() or ""
|
146 |
else:
|
147 |
# Handle zip file
|
|
|
148 |
zip_path = "uploads/uploaded.zip"
|
149 |
with open(zip_path, "wb") as f:
|
150 |
f.write(input_data.getvalue())
|
@@ -162,7 +165,7 @@ def process_input(input_type, input_data):
|
|
162 |
|
163 |
# Clean up extracted files
|
164 |
shutil.rmtree("uploads/extracted", ignore_errors=True)
|
165 |
-
os.remove(zip_path)
|
166 |
|
167 |
# Split text
|
168 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
|
|
|
31 |
|
32 |
# Sidebar
|
33 |
with st.sidebar:
|
34 |
+
# BSNL Logo (local file with error handling)
|
35 |
+
try:
|
36 |
+
st.image(
|
37 |
+
"bsnl_logo.png",
|
38 |
+
width=200
|
39 |
+
)
|
40 |
+
except FileNotFoundError:
|
41 |
+
st.warning("BSNL logo not found. Please ensure 'bsnl_logo.png' exists in the project root.")
|
42 |
st.header("RAG Control Panel")
|
43 |
api_key_input = st.text_input("Enter RAG Access Key", type="password")
|
44 |
|
|
|
74 |
|
75 |
# Main app
|
76 |
def main():
|
77 |
+
# Inject CSS for simple color scheme and clean styling
|
78 |
st.markdown("""
|
79 |
<style>
|
80 |
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
|
81 |
.stApp {
|
82 |
+
background-color: #FFFFFF; /* White background */
|
83 |
font-family: 'Roboto', sans-serif;
|
84 |
+
color: #333333;
|
85 |
}
|
86 |
.stTextInput > div > div > input {
|
87 |
+
background-color: #FFFFFF;
|
88 |
color: #333333;
|
89 |
border-radius: 8px;
|
90 |
+
border: 1px solid #007BFF;
|
91 |
padding: 10px;
|
92 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
93 |
}
|
94 |
.stButton > button {
|
95 |
+
background-color: #007BFF;
|
96 |
color: white;
|
97 |
border-radius: 8px;
|
98 |
padding: 10px 20px;
|
|
|
101 |
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
102 |
}
|
103 |
.stButton > button:hover {
|
104 |
+
background-color: #0056b3;
|
105 |
transform: scale(1.05);
|
106 |
}
|
107 |
.stSidebar {
|
108 |
+
background-color: #F5F5F5; /* Light gray */
|
109 |
padding: 20px;
|
110 |
+
border-right: 2px solid #007BFF;
|
111 |
}
|
112 |
h1, h2, h3 {
|
113 |
+
color: #333333;
|
|
|
114 |
}
|
115 |
.stSpinner > div > div {
|
116 |
+
border-color: #007BFF transparent transparent transparent;
|
117 |
}
|
118 |
</style>
|
119 |
""", unsafe_allow_html=True)
|
120 |
|
121 |
+
st.title("BSNL Rourkela May I Help You")
|
122 |
+
st.markdown("Welcome to the BSNL AI ChatBoot Rourkela App! Upload your PDFs and ask questions with ease.", unsafe_allow_html=True)
|
123 |
|
124 |
if not st.session_state.authenticated:
|
125 |
st.warning("Please authenticate with your API key in the sidebar.")
|
|
|
147 |
documents += page.extract_text() or ""
|
148 |
else:
|
149 |
# Handle zip file
|
150 |
+
zip_path = "uploads/uploaded outrightedefault: true
|
151 |
zip_path = "uploads/uploaded.zip"
|
152 |
with open(zip_path, "wb") as f:
|
153 |
f.write(input_data.getvalue())
|
|
|
165 |
|
166 |
# Clean up extracted files
|
167 |
shutil.rmtree("uploads/extracted", ignore_errors=True)
|
168 |
+
os.remove Whose fault is it if you get hit by a drunk driver?(zip_path)
|
169 |
|
170 |
# Split text
|
171 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
|