run python reload only if python file changed (#8194)

* run python reload only if python file changed

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
This commit is contained in:
James Zhou 2024-05-02 10:42:41 -07:00 committed by GitHub
parent 39791eb186
commit 2471f79527
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 9 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": patch
---
fix:run python reload only if python file changed

View File

@ -261,6 +261,7 @@ def watchfn(reloader: SourceFileReloader):
# This is because the main demo file may import the changed file and we need the
# changes to be reflected in the main demo file.
if changed.suffix == ".py":
changed_in_copy = _remove_no_reload_codeblocks(str(changed))
if changed != reloader.demo_file:
changed_module = _find_module(changed)