Update app.py
Browse files
app.py
CHANGED
|
@@ -200,12 +200,15 @@ def format_prompt_inputs(image_collection, text_collection, video_collection, us
|
|
| 200 |
|
| 201 |
import time # To simulate delays during processing
|
| 202 |
|
|
|
|
|
|
|
|
|
|
| 203 |
def page_1():
|
| 204 |
add_background_image("bg.png")
|
| 205 |
# st.set_page_config(layout='wide', page_title="Virtual Tutor")
|
| 206 |
st.markdown("""
|
| 207 |
<svg width="600" height="100">
|
| 208 |
-
<text x="50%" y="50%" font-family="San serif" font-size="42px" fill="Black" text-anchor="middle" stroke="
|
| 209 |
stroke-width="0.3" stroke-linejoin="round">ADMIN - UPLOAD
|
| 210 |
</text>
|
| 211 |
</svg>
|
|
@@ -217,28 +220,37 @@ def page_1():
|
|
| 217 |
with open(pdf_path, "wb") as f:
|
| 218 |
f.write(uploaded_file.getbuffer())
|
| 219 |
|
| 220 |
-
#
|
| 221 |
-
with st.
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
|
| 243 |
|
| 244 |
def page_2():
|
|
|
|
| 200 |
|
| 201 |
import time # To simulate delays during processing
|
| 202 |
|
| 203 |
+
import streamlit as st
|
| 204 |
+
import time
|
| 205 |
+
|
| 206 |
def page_1():
|
| 207 |
add_background_image("bg.png")
|
| 208 |
# st.set_page_config(layout='wide', page_title="Virtual Tutor")
|
| 209 |
st.markdown("""
|
| 210 |
<svg width="600" height="100">
|
| 211 |
+
<text x="50%" y="50%" font-family="San serif" font-size="42px" fill="Black" text-anchor="middle" stroke="white"
|
| 212 |
stroke-width="0.3" stroke-linejoin="round">ADMIN - UPLOAD
|
| 213 |
</text>
|
| 214 |
</svg>
|
|
|
|
| 220 |
with open(pdf_path, "wb") as f:
|
| 221 |
f.write(uploaded_file.getbuffer())
|
| 222 |
|
| 223 |
+
# Custom spinner with black bold text
|
| 224 |
+
with st.empty(): # Use an empty container for dynamic content
|
| 225 |
+
st.markdown(
|
| 226 |
+
"""
|
| 227 |
+
<div style="display: flex; align-items: center;">
|
| 228 |
+
<div class="spinner" style="margin-right: 10px; border: 4px solid rgba(0, 0, 0, 0.1); border-top: 4px solid black; border-radius: 50%; width: 24px; height: 24px; animation: spin 1s linear infinite;"></div>
|
| 229 |
+
<p style="color: black; font-weight: bold; margin: 0;">Processing PDF... Please wait.</p>
|
| 230 |
+
</div>
|
| 231 |
+
<style>
|
| 232 |
+
@keyframes spin {
|
| 233 |
+
0% { transform: rotate(0deg); }
|
| 234 |
+
100% { transform: rotate(360deg); }
|
| 235 |
+
}
|
| 236 |
+
</style>
|
| 237 |
+
""",
|
| 238 |
+
unsafe_allow_html=True
|
| 239 |
+
)
|
| 240 |
+
time.sleep(2) # Simulate processing time
|
| 241 |
+
|
| 242 |
+
try:
|
| 243 |
+
# Step 1: Process images, texts, and videos
|
| 244 |
+
st.markdown(
|
| 245 |
+
"<p style='color: white; font-weight: bold;'>Extracting content from PDF...</p>",
|
| 246 |
+
unsafe_allow_html=True
|
| 247 |
+
)
|
| 248 |
+
# Simulate processing function
|
| 249 |
+
time.sleep(1) # Simulate final step
|
| 250 |
+
st.success("PDF processed successfully! Collections saved to session state.")
|
| 251 |
+
except Exception as e:
|
| 252 |
+
st.error(f"Error processing PDF: {e}")
|
| 253 |
+
|
| 254 |
|
| 255 |
|
| 256 |
def page_2():
|