Spaces:
Build error
Build error
talexm commited on
Commit ·
a463e6e
1
Parent(s): 759c15a
update
Browse files- app.py +24 -4
- rag_sec/document_search_system.py +4 -4
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import
|
|
|
|
| 3 |
from pathlib import Path
|
|
|
|
| 4 |
from PIL import Image
|
| 5 |
from rag_sec.document_search_system import DocumentSearchSystem
|
| 6 |
from chainguard.blockchain_logger import BlockchainLogger
|
|
@@ -34,10 +36,28 @@ os.makedirs(UPLOAD_DIR, exist_ok=True)
|
|
| 34 |
st.title("Memora: Secure File Upload and Search with Blockchain & Neo4j")
|
| 35 |
st.subheader("Securely upload, organize, and query your files")
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
# File Upload Section
|
| 38 |
-
uploaded_files = st.file_uploader(
|
| 39 |
-
"Upload your files", accept_multiple_files=True, type=['jpg', 'jpeg', 'png', 'mp4', 'avi']
|
| 40 |
-
)
|
| 41 |
|
| 42 |
if uploaded_files:
|
| 43 |
for uploaded_file in uploaded_files:
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from googlesearch import search
|
| 3 |
+
import pandas as pd
|
| 4 |
from pathlib import Path
|
| 5 |
+
import os
|
| 6 |
from PIL import Image
|
| 7 |
from rag_sec.document_search_system import DocumentSearchSystem
|
| 8 |
from chainguard.blockchain_logger import BlockchainLogger
|
|
|
|
| 36 |
st.title("Memora: Secure File Upload and Search with Blockchain & Neo4j")
|
| 37 |
st.subheader("Securely upload, organize, and query your files")
|
| 38 |
|
| 39 |
+
# Google Search Section
|
| 40 |
+
st.subheader("Find User Information via Google Search")
|
| 41 |
+
search_query = st.text_input("Enter a name or topic to search on Google")
|
| 42 |
+
|
| 43 |
+
if st.button("Google Search"):
|
| 44 |
+
if search_query:
|
| 45 |
+
try:
|
| 46 |
+
results = list(search(search_query, num_results=5)) # Fetch top 5 results
|
| 47 |
+
if results:
|
| 48 |
+
st.success(f"Top {len(results)} results for '{search_query}':")
|
| 49 |
+
result_data = {"URL": results}
|
| 50 |
+
df = pd.DataFrame(result_data)
|
| 51 |
+
st.dataframe(df)
|
| 52 |
+
else:
|
| 53 |
+
st.warning("No results found for the search query.")
|
| 54 |
+
except Exception as e:
|
| 55 |
+
st.error(f"An error occurred during the search: {str(e)}")
|
| 56 |
+
else:
|
| 57 |
+
st.warning("Please enter a search query.")
|
| 58 |
+
|
| 59 |
# File Upload Section
|
| 60 |
+
uploaded_files = st.file_uploader("Upload your files", accept_multiple_files=True, type=['jpg', 'jpeg', 'png', 'mp4', 'avi'])
|
|
|
|
|
|
|
| 61 |
|
| 62 |
if uploaded_files:
|
| 63 |
for uploaded_file in uploaded_files:
|
rag_sec/document_search_system.py
CHANGED
|
@@ -7,10 +7,10 @@ import sys
|
|
| 7 |
from os import path
|
| 8 |
|
| 9 |
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
|
| 10 |
-
from
|
| 11 |
-
from
|
| 12 |
-
from
|
| 13 |
-
from
|
| 14 |
|
| 15 |
|
| 16 |
class DataTransformer:
|
|
|
|
| 7 |
from os import path
|
| 8 |
|
| 9 |
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
|
| 10 |
+
from bad_query_detector import BadQueryDetector
|
| 11 |
+
from query_transformer import QueryTransformer
|
| 12 |
+
from document_retriver import DocumentRetriever
|
| 13 |
+
from senamtic_response_generator import SemanticResponseGenerator
|
| 14 |
|
| 15 |
|
| 16 |
class DataTransformer:
|