Update app.py
Browse files
app.py
CHANGED
@@ -220,10 +220,37 @@ def page_1():
|
|
220 |
progress_bar.progress(100)
|
221 |
status_text.text("Processing completed successfully!")
|
222 |
st.success("PDF processed successfully! Collections saved to session state.")
|
|
|
223 |
except Exception as e:
|
224 |
progress_bar.progress(0)
|
225 |
status_text.text("")
|
226 |
st.error(f"Error processing PDF: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
|
228 |
|
229 |
def page_2():
|
|
|
220 |
progress_bar.progress(100)
|
221 |
status_text.text("Processing completed successfully!")
|
222 |
st.success("PDF processed successfully! Collections saved to session state.")
|
223 |
+
|
224 |
except Exception as e:
|
225 |
progress_bar.progress(0)
|
226 |
status_text.text("")
|
227 |
st.error(f"Error processing PDF: {e}")
|
228 |
+
|
229 |
+
# Simple Video Query Section
|
230 |
+
st.subheader("Search for Videos")
|
231 |
+
|
232 |
+
# Query input for videos
|
233 |
+
video_query = st.text_input("Enter a query to search videos", value="")
|
234 |
+
|
235 |
+
if video_query:
|
236 |
+
video_results = video_collection.query(
|
237 |
+
query_texts=[video_query],
|
238 |
+
n_results=5,
|
239 |
+
include=['uris', 'distances', 'metadatas']
|
240 |
+
)
|
241 |
+
|
242 |
+
uris = video_results['uris'][0]
|
243 |
+
distances = video_results['distances'][0]
|
244 |
+
metadatas = video_results['metadatas'][0]
|
245 |
+
|
246 |
+
if uris:
|
247 |
+
st.write(f"Found {len(uris)} video(s) for your query.")
|
248 |
+
for uri, distance, metadata in zip(uris, distances, metadatas):
|
249 |
+
video_uri = metadata['video_uri']
|
250 |
+
st.write(f"Video URI: {video_uri} (Distance: {distance})")
|
251 |
+
st.video(video_uri) # Display video
|
252 |
+
else:
|
253 |
+
st.write("No videos found for the query.")
|
254 |
|
255 |
|
256 |
def page_2():
|