Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can’t run test code with local index #74

Open
luancaarvalho opened this issue Sep 21, 2023 · 2 comments
Open

Can’t run test code with local index #74

luancaarvalho opened this issue Sep 21, 2023 · 2 comments

Comments

@luancaarvalho
Copy link

Hello Feder team!

I'm trying to run your test example, but without using a remote index source location like `https://assets.zilliz.com/hnswlib_hnsw_voc_17k_1f1dfd63a9.index%60. I downloaded the index and put it in my directory.
With the remote index, all the visualizations were loaded, but with the local index, the visualizations didn't load and became stuck in an infinite loop.
Can you explain why this is happening, please?

Here is the code with both sources:

from federpy.federpy import FederPy

if __name__ == '__main__':
    hnswSource = 'hnswlib'
    hnswIndexFile = 'https://assets.zilliz.com/hnswlib_hnsw_voc_17k_1f1dfd63a9.index'
    # hnswIndexFile = 'hnswlib_hnsw_voc_17k_1f1dfd63a9.index'

    # Lite version, only input indexFile, no viewParams, no images.
    federPy_hnsw_lite = FederPy(hnswIndexFile, hnswSource)

    # federPy_hnsw_lite.overview()
    federPy_hnsw_lite.searchRandTestVec()
@alwayslove2013
Copy link
Collaborator

@luancaarvalho FederPy cannot read local files directly.
In fact, FederPy generates an html for display. This hmtl is run by the browser. It will read the index file in the browser and call FederJs to parse it. Note that browsers are not allowed to read local files directly, which violates the CORS protocol.
If you want to read a local file, you first have to place the index file on the "network". Maybe you can place it on s3 so that other people on the network can see what you're sharing. Or a simpler example, you can use Python's SimpleHTTPServer to build a simple static file server, then Feder can find your index file from localhost.

@amalpushp77
Copy link

amalpushp77 commented Mar 11, 2024

Sharing index file through Google drive is not working. Is there a solution to run on colab notebook?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants