jrrribeiro commited on
Commit
fc203ae
·
1 Parent(s): 3ad9776

fix(runtime): stabilize gradio api schema handling on startup

Browse files
Files changed (2) hide show
  1. app.py +15 -1
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1,9 +1,23 @@
1
  import os
2
 
 
 
3
  from src.ui.upload_app_factory import build_upload_app
4
 
5
 
 
 
 
 
 
 
 
 
 
 
 
6
  if __name__ == "__main__":
 
7
  app = build_upload_app()
8
  port = int(os.getenv("BIRDNET_UPLOADER_PORT", "7862"))
9
- app.launch(server_name="0.0.0.0", server_port=port)
 
1
  import os
2
 
3
+ from gradio_client import utils as gradio_client_utils
4
+
5
  from src.ui.upload_app_factory import build_upload_app
6
 
7
 
8
+ def _patch_gradio_schema_bool_handling() -> None:
9
+ original_get_type = gradio_client_utils.get_type
10
+
11
+ def safe_get_type(schema):
12
+ if isinstance(schema, bool):
13
+ return "Any" if schema else "None"
14
+ return original_get_type(schema)
15
+
16
+ gradio_client_utils.get_type = safe_get_type
17
+
18
+
19
  if __name__ == "__main__":
20
+ _patch_gradio_schema_bool_handling()
21
  app = build_upload_app()
22
  port = int(os.getenv("BIRDNET_UPLOADER_PORT", "7862"))
23
+ app.launch(server_name="0.0.0.0", server_port=port, show_api=False)
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
- gradio>=5.0.0
 
2
  huggingface_hub>=0.30.0,<1.0.0
3
  pydantic>=2.8.0
4
  pandas>=2.2.0
 
1
+ gradio==5.9.1
2
+ gradio_client==1.5.2
3
  huggingface_hub>=0.30.0,<1.0.0
4
  pydantic>=2.8.0
5
  pandas>=2.2.0