Spaces:
Sleeping
Sleeping
Merge branch 'main' of https://huggingface.co/spaces/nand-tmp/GoogleSearchWithLLM
Browse files- app.py +6 -2
- requirements.txt +89 -0
app.py
CHANGED
@@ -28,6 +28,8 @@ if "messages" not in st.session_state:
|
|
28 |
if "doc" not in st.session_state:
|
29 |
st.session_state.doc = None
|
30 |
|
|
|
|
|
31 |
if "refresh" not in st.session_state:
|
32 |
st.session_state.refresh = True
|
33 |
|
@@ -46,11 +48,13 @@ if prompt := st.chat_input("Search Here insetad of Google"):
|
|
46 |
|
47 |
s = SemanticSearch(
|
48 |
st.session_state.doc,
|
49 |
-
st.session_state.configs["model"]["embeding_model"],
|
50 |
-
st.session_state.configs["model"]["device"],
|
51 |
)
|
52 |
topk, u = s.semantic_search(query=prompt, k=32)
|
53 |
output = st.session_state.model.answer_query(query=prompt, topk_items=topk)
|
|
|
|
|
54 |
response = output
|
55 |
with st.chat_message("assistant"):
|
56 |
st.markdown(response)
|
|
|
28 |
if "doc" not in st.session_state:
|
29 |
st.session_state.doc = None
|
30 |
|
31 |
+
if "refresh" not in st.session_state:
|
32 |
+
st.session_state.refresh = True
|
33 |
if "refresh" not in st.session_state:
|
34 |
st.session_state.refresh = True
|
35 |
|
|
|
48 |
|
49 |
s = SemanticSearch(
|
50 |
st.session_state.doc,
|
51 |
+
st.session_state.st.session_state.configs["model"]["embeding_model"],
|
52 |
+
st.session_state.st.session_state.configs["model"]["device"],
|
53 |
)
|
54 |
topk, u = s.semantic_search(query=prompt, k=32)
|
55 |
output = st.session_state.model.answer_query(query=prompt, topk_items=topk)
|
56 |
+
topk, u = s.semantic_search(query=prompt, k=32)
|
57 |
+
output = st.session_state.model.answer_query(query=prompt, topk_items=topk)
|
58 |
response = output
|
59 |
with st.chat_message("assistant"):
|
60 |
st.markdown(response)
|
requirements.txt
CHANGED
@@ -87,3 +87,92 @@ urllib3==2.1.0
|
|
87 |
watchdog==4.0.0
|
88 |
wheel==0.41.2
|
89 |
zipp==3.18.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
watchdog==4.0.0
|
88 |
wheel==0.41.2
|
89 |
zipp==3.18.1
|
90 |
+
accelerate==0.29.2
|
91 |
+
albumentations==1.4.3
|
92 |
+
altair==5.3.0
|
93 |
+
attrs==23.2.0
|
94 |
+
beautifulsoup4==4.12.3
|
95 |
+
bitsandbytes==0.43.1
|
96 |
+
blinker==1.7.0
|
97 |
+
cachetools==5.3.3
|
98 |
+
certifi==2024.2.2
|
99 |
+
charset-normalizer==2.0.4
|
100 |
+
click==8.1.7
|
101 |
+
colorama==0.4.6
|
102 |
+
contourpy==1.2.1
|
103 |
+
cycler==0.12.1
|
104 |
+
filelock==3.13.1
|
105 |
+
fonttools==4.50.0
|
106 |
+
fsspec==2024.3.1
|
107 |
+
gitdb==4.0.11
|
108 |
+
GitPython==3.1.43
|
109 |
+
gmpy2==2.1.2
|
110 |
+
huggingface-hub==0.22.2
|
111 |
+
idna==3.4
|
112 |
+
imageio==2.34.0
|
113 |
+
importlib_resources==6.4.0
|
114 |
+
Jinja2==3.1.3
|
115 |
+
joblib==1.3.2
|
116 |
+
jsonschema==4.21.1
|
117 |
+
jsonschema-specifications==2023.12.1
|
118 |
+
kiwisolver==1.4.5
|
119 |
+
lazy_loader==0.4
|
120 |
+
markdown-it-py==3.0.0
|
121 |
+
MarkupSafe==2.1.3
|
122 |
+
matplotlib==3.8.4
|
123 |
+
mdurl==0.1.2
|
124 |
+
mkl-fft==1.3.8
|
125 |
+
mkl-random==1.2.4
|
126 |
+
mkl-service==2.4.0
|
127 |
+
mpmath==1.3.0
|
128 |
+
networkx==3.1
|
129 |
+
nltk==3.8.1
|
130 |
+
numpy==1.26.4
|
131 |
+
opencv-python-headless==4.9.0.80
|
132 |
+
packaging==24.0
|
133 |
+
pandas==2.2.2
|
134 |
+
pillow==10.2.0
|
135 |
+
pip==23.3.1
|
136 |
+
protobuf==4.25.3
|
137 |
+
psutil==5.9.8
|
138 |
+
pyarrow==16.0.0
|
139 |
+
pydeck==0.8.1b0
|
140 |
+
Pygments==2.17.2
|
141 |
+
pyparsing==3.1.2
|
142 |
+
python-dateutil==2.9.0.post0
|
143 |
+
pytz==2024.1
|
144 |
+
PyYAML==6.0.1
|
145 |
+
referencing==0.34.0
|
146 |
+
regex==2024.4.16
|
147 |
+
requests==2.31.0
|
148 |
+
rich==13.7.1
|
149 |
+
rpds-py==0.18.0
|
150 |
+
safetensors==0.4.3
|
151 |
+
scikit-image==0.22.0
|
152 |
+
scikit-learn==1.4.1.post1
|
153 |
+
scipy==1.13.0
|
154 |
+
sentence-transformers==2.7.0
|
155 |
+
setuptools==68.2.2
|
156 |
+
six==1.16.0
|
157 |
+
smmap==5.0.1
|
158 |
+
soupsieve==2.5
|
159 |
+
streamlit==1.33.0
|
160 |
+
sympy==1.12
|
161 |
+
tenacity==8.2.3
|
162 |
+
threadpoolctl==3.4.0
|
163 |
+
tifffile==2024.2.12
|
164 |
+
tokenizers==0.15.2
|
165 |
+
toml==0.10.2
|
166 |
+
toolz==0.12.1
|
167 |
+
torch==2.2.2
|
168 |
+
torchaudio==2.2.2
|
169 |
+
torchvision==0.17.2
|
170 |
+
tornado==6.4
|
171 |
+
tqdm==4.66.2
|
172 |
+
transformers==4.39.3
|
173 |
+
typing_extensions==4.9.0
|
174 |
+
tzdata==2024.1
|
175 |
+
urllib3==2.1.0
|
176 |
+
watchdog==4.0.0
|
177 |
+
wheel==0.41.2
|
178 |
+
zipp==3.18.1
|