Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,8 @@ from fastembed import SparseTextEmbedding
|
|
| 4 |
def sparseembed(docs):
|
| 5 |
model = SparseTextEmbedding(model_name="Qdrant/bm25")
|
| 6 |
embeddings = list(model.embed(docs))
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
iface = gr.Interface(
|
| 10 |
fn=sparseembed,
|
|
@@ -16,4 +17,4 @@ iface = gr.Interface(
|
|
| 16 |
)
|
| 17 |
|
| 18 |
if __name__ == "__main__":
|
| 19 |
-
iface.launch()
|
|
|
|
| 4 |
def sparseembed(docs):
|
| 5 |
model = SparseTextEmbedding(model_name="Qdrant/bm25")
|
| 6 |
embeddings = list(model.embed(docs))
|
| 7 |
+
# преобразуем x.values и x.indices в list
|
| 8 |
+
return [ (x.values.tolist(), x.indices.tolist()) for x in embeddings ]
|
| 9 |
|
| 10 |
iface = gr.Interface(
|
| 11 |
fn=sparseembed,
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
if __name__ == "__main__":
|
| 20 |
+
iface.launch()
|