Fix reload mode warning about not being able to find the app (#6660)

* Fix warning

* add changeset

* Use *

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Freddy Boulton 2023-12-05 13:25:40 -05:00 committed by GitHub
parent fce80ac804
commit 523805360b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": patch
---
fix:Fix reload mode warning about not being able to find the app

View File

@ -35,14 +35,14 @@ def _setup_config(
app_text = original_path.read_text(encoding=encoding)
patterns = [
f"with gr\\.Blocks\\(\\) as {demo_name}",
f"with gr\\.Blocks\\(.*\\) as {demo_name}",
f"{demo_name} = gr\\.Blocks",
f"{demo_name} = gr\\.Interface",
f"{demo_name} = gr\\.ChatInterface",
f"{demo_name} = gr\\.TabbedInterface",
]
if not any(re.search(p, app_text) for p in patterns):
if not any(re.search(p, app_text, flags=re.DOTALL) for p in patterns):
print(
f"\n[bold red]Warning[/]: Cannot statically find a gradio demo called {demo_name}. "
"Reload work may fail."