vale46n1 / immich_duplicate_finder

A Comprehensive Solution for Identifying and Managing Duplicate Photos in Immich
Apache License 2.0
184 stars 12 forks source link

Displaying duplicates failed. #14

Closed Larry3best closed 4 months ago

Larry3best commented 4 months ago

I get this error after building the index and the app tries to display the duplicates: Found 7 duplicate pairs with FAISS code: One or both of the assets are not images and cannot be compared.

TypeError: 'NoneType' object is not subscriptable
Traceback:
File "/home/dietpi/.local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 542, in _run_script
    exec(code, module.__dict__)
File "/home/dietpi/immich_duplicate_finder/app.py", line 285, in <module>
    main()
File "/home/dietpi/immich_duplicate_finder/app.py", line 276, in main
    show_duplicate_photos_faiss(assets,50,st.session_state['faiss_threshold']) #Limit / threshold
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dietpi/immich_duplicate_finder/app.py", line 170, in show_duplicate_photos_faiss
    display_asset_column(
File "/home/dietpi/immich_duplicate_finder/utility.py", line 31, in display_asset_column
    - **File name:** {asset1_info[1]}
                      ~~~~~~~~~~~^^^

Is this because the files are videos? Thanks

vale46n1 commented 4 months ago

I guess the problem is because asset1_info is None. I revised code to manage this situation

vale46n1 commented 4 months ago

variable assets is used before being defined in all possible paths of the function. This can cause the UnboundLocalError if any exception occurs before assets is assigned from the response.json() call. To avoid this I'll fix the code to initialize assets to a default value before the try block Code now is fixed (and imporved with a new vector engine!) Let me know if now is working