krishnaik06 / Google-Gemini-Crash-Course

GNU General Public License v3.0
223 stars 171 forks source link

Code not working #6

Open siddharthkandhway opened 6 months ago

siddharthkandhway commented 6 months ago

When i am running this code the error is coming

ValueError: The de-serialization relies loading a pickle file. Pickle files can be modified to deliver a malicious payload that results in execution of arbitrary code on your machine.You will need to set allow_dangerous_deserialization to True to enable deserialization. If you do this, make sure that you trust the source of the data. For example, if you are loading a file that you created, and no that no one else has modified the file, then this is safe to do. Do not set this to True if you are loading a file from an untrusted source (e.g., some random site on the internet.). Traceback: File "C:\Users\siddh\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 542, in _run_script exec(code, module.dict) File "D:\gemini pro\P0\pdfapp.py", line 106, in main() File "D:\gemini pro\P0\pdfapp.py", line 91, in main user_input(user_question) File "D:\gemini pro\P0\pdfapp.py", line 68, in user_input new_db = FAISS.load_local("faiss_index", embeddings) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I have used Chat gpt to change the code as required but new error comes each time after 1 error is resolved

lakshaya17 commented 5 months ago

Update

new_db = FAISS.load_local("faiss_index", embeddings)

to

new_db = FAISS.load_local("faiss_index", embeddings, allow_dangerous_deserialization = True)

and then run it. It will solve the issue.