srbhr / Resume-Matcher

Resume Matcher is an open source, free tool to improve your resume. It works by using language models to compare and rank resumes with job descriptions.
https://www.resumematcher.fyi/
Apache License 2.0
4.76k stars 1.93k forks source link

Having less than 2 resumes causes an error: "IndexError: list index out of range" #117

Closed mohamedaleya closed 10 months ago

mohamedaleya commented 11 months ago

Issue Title

Having less than 2 resumes causes an error: "IndexError: list index out of range"

Type

Description

If you have 2 resumes or less, you will receive an error after launching the app with the command streamlit run streamlit_app.py (or streamlit run streamlit_second.py). The slider defaults to the max index of the list. Resulting in an attempt to render a non-existent item. Also if you have only 1 resume, you shouldn't have a slider. And if you have no resume, some hint should be displayed to remind the user to add a resume.

This issue should help improve the UX for the time being until the new web app version is available to users.

Expected Behavior

There should be no errors, no matter how many resumes the user has. The four points above make sure of that.

Current Behavior

If I have 1 resume, the slider will have 0, 1 and 2 indexes. 1 and 2 do not work. Therefore I need to set the slider to the index 0 to see relevant results.

Steps to Reproduce

  1. Add no more than 2 resumes.
  2. Use the cmd streamlit run streamlit_app.py.
  3. The app will open to an error (in the resume section) as the slider's default selection is set to the maximum index (for this case, 2).

Screenshots / Code Snippets (if applicable)

brave_cDGFzeWdfJ

Environment

Possible Solution (if you have any in mind)

Add conditions to display the appropriate content for no resumes, 1 resume, and 1 or more resumes available.

Additional Information

I've worked on a solution and will follow up on this issue with a PR.

srbhr commented 11 months ago

Hi @mohamedaleya, thanks for this PR. But Streamlit_second is for deploying to streamlit for demo purpose. You aren't required to run it.

mohamedaleya commented 11 months ago

Hi @mohamedaleya, thanks for this PR. But Streamlit_second is for deploying to streamlit for demo purpose. You aren't required to run it.

Sorry my bad. I have now updated the PR with changes applied to streamlit_app as well. Let me know if there's anything else I should rectify!

srbhr commented 10 months ago

This was fixed.