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

cache the custom model fields in the browser for convenience #447

Closed
wants to merge 1 commit into from

Conversation

cocktailpeanut
Copy link
Collaborator

The new custom model feature is very powerful but undermined by the fact that you have to type the HF urls every time.

This PR simply caches the field values to the browser localStorage when they change, so when you click "custom", the last used values are already filled out.

@SWivid
Copy link
Owner

SWivid commented Nov 11, 2024

@cocktailpeanut , thanks for pr~
Have a modified commit for caching 59761ec, cuz using js might have future problem if switch to other gradio component / switch to gradio 5.
See if last commit works.

@cocktailpeanut
Copy link
Collaborator Author

cocktailpeanut commented Nov 11, 2024

@cocktailpeanut , thanks for pr~ Have a modified commit for caching 59761ec, cuz using js might have future problem if switch to other gradio component / switch to gradio 5. See if last commit works.

I tested this and i think it's kind of broken. Right now what happens is when you use a custom model, it does get saved to the txt file, but then when you reload and click "custom" again, it triggers this: 59761ec#diff-c0b08fdea1b5d0d960bc35f91b2b1e45be003a21fb87c7ad4e5f7016bf9cf078R795-R800 which triggers switch_tts_model, at which point the new_choice is Custom, and the custom_ckpt_path and custom_vocab_path are the default SWivid URLs, so just by clicking custom, it resets the custom model we just reset here 59761ec#diff-c0b08fdea1b5d0d960bc35f91b2b1e45be003a21fb87c7ad4e5f7016bf9cf078R764-R766 so there is no effect.

Maybe I am missing something. If you let me know I can test again.

@SWivid
Copy link
Owner

SWivid commented Nov 11, 2024

will test, yes it broke.

update: it's for initialization problem, if simply refresh the webpage, init value will not reload from cache but retain the previous one while starting the gradio service; if restart the service, it's all right then.
fixing...

@SWivid
Copy link
Owner

SWivid commented Nov 11, 2024

fixed in be53fb1

@cocktailpeanut
Copy link
Collaborator Author

@SWivid just tried, it works! 🫡

@SWivid SWivid closed this Nov 11, 2024
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

Successfully merging this pull request may close these issues.

2 participants