michaelfeil
commited on
Commit
•
0255774
1
Parent(s):
34ece89
update demo
Browse files- Dockerfile +1 -1
- search.py +7 -3
Dockerfile
CHANGED
@@ -5,4 +5,4 @@ RUN pip install groq gradio infinity_emb[all] usearch datasets
|
|
5 |
WORKDIR /app
|
6 |
COPY . .
|
7 |
|
8 |
-
CMD entrypoint.sh
|
|
|
5 |
WORKDIR /app
|
6 |
COPY . .
|
7 |
|
8 |
+
CMD bash entrypoint.sh
|
search.py
CHANGED
@@ -2,7 +2,7 @@ from infinity_emb import AsyncEmbeddingEngine, EngineArgs
|
|
2 |
import numpy as np
|
3 |
from usearch.index import Index, Matches
|
4 |
import asyncio
|
5 |
-
import
|
6 |
|
7 |
engine = AsyncEmbeddingEngine.from_args(
|
8 |
EngineArgs(
|
@@ -47,8 +47,12 @@ def build_index(demo_mode=True):
|
|
47 |
embeddings = embed_texts_sync(docs_index)
|
48 |
index.add(np.arange(len(docs_index)), embeddings)
|
49 |
return
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
52 |
|
53 |
if index is None:
|
54 |
build_index()
|
|
|
2 |
import numpy as np
|
3 |
from usearch.index import Index, Matches
|
4 |
import asyncio
|
5 |
+
import datasets
|
6 |
|
7 |
engine = AsyncEmbeddingEngine.from_args(
|
8 |
EngineArgs(
|
|
|
47 |
embeddings = embed_texts_sync(docs_index)
|
48 |
index.add(np.arange(len(docs_index)), embeddings)
|
49 |
return
|
50 |
+
else:
|
51 |
+
ds = datasets.load_dataset("michaelfeil/mined_docstrings_pypi_embedded")
|
52 |
+
ds = ds["train"]
|
53 |
+
docs_index = ds["code"]
|
54 |
+
embeddings = ds["embed_func_code"]
|
55 |
+
index.add(np.arange(len(docs_index)), embeddings)
|
56 |
|
57 |
if index is None:
|
58 |
build_index()
|