Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,26 +14,10 @@ Search is an area that a lot of companies have invested in. Any retail company h
|
|
14 |
One of the bottlenecks in including semantics in search is latency - The more sophisticated the search, the slower the search inference will be. This is why for semantic search, there is no one-stop solution in a real-world scenario. Even though we have ChatGPT to return amazing results with the right prompting, we know what the latency this will incur, thus making it less viable in this scenario :-)
|
15 |
"""
|
16 |
|
17 |
-
'''
|
18 |
-
from google.colab import drive
|
19 |
-
drive.mount('/content/drive')
|
20 |
-
'''
|
21 |
-
|
22 |
-
"""## Install dependencies"""
|
23 |
-
'''
|
24 |
-
!pip3 install sentence-transformers
|
25 |
-
!pip install datasets
|
26 |
-
!pip install -q streamlit
|
27 |
-
'''
|
28 |
-
"""## 1. Embeddings
|
29 |
-
|
30 |
-
Work on developing an embeddings class that goes from the simple glove embeddings to the more intricate sentence transformer embeddings
|
31 |
-
"""
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
"""
|
37 |
import numpy as np
|
38 |
import requests
|
39 |
import os
|
@@ -132,10 +116,7 @@ class Embeddings:
|
|
132 |
|
133 |
return glove_embedding
|
134 |
|
135 |
-
"""## 2. Search Class
|
136 |
|
137 |
-
Implement a class with all the methods needed for search including cosine similarity
|
138 |
-
"""
|
139 |
|
140 |
import numpy.linalg as la
|
141 |
import numpy as np
|
@@ -197,10 +178,7 @@ class Search:
|
|
197 |
return similarity_scores
|
198 |
|
199 |
|
200 |
-
"""## 4. Plots
|
201 |
|
202 |
-
Plot the search results as a pie chart with percentages allocated to the likelihood of the category being related to the search input
|
203 |
-
"""
|
204 |
|
205 |
import matplotlib.pyplot as plt
|
206 |
|
|
|
14 |
One of the bottlenecks in including semantics in search is latency - The more sophisticated the search, the slower the search inference will be. This is why for semantic search, there is no one-stop solution in a real-world scenario. Even though we have ChatGPT to return amazing results with the right prompting, we know what the latency this will incur, thus making it less viable in this scenario :-)
|
15 |
"""
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
|
19 |
+
|
20 |
+
|
|
|
21 |
import numpy as np
|
22 |
import requests
|
23 |
import os
|
|
|
116 |
|
117 |
return glove_embedding
|
118 |
|
|
|
119 |
|
|
|
|
|
120 |
|
121 |
import numpy.linalg as la
|
122 |
import numpy as np
|
|
|
178 |
return similarity_scores
|
179 |
|
180 |
|
|
|
181 |
|
|
|
|
|
182 |
|
183 |
import matplotlib.pyplot as plt
|
184 |
|