Spaces:
Sleeping
Sleeping
| import asyncio | |
| import os | |
| import sys | |
| import warnings | |
| os.environ.setdefault("GRADIO_ANALYTICS_ENABLED", "False") | |
| # Gradio startup probes create short-lived asyncio loops; Python 3.11 can log | |
| # harmless "Invalid file descriptor: -1" noise when those loops are GC'd. | |
| if not getattr(asyncio.base_events.BaseEventLoop, "_finsight_safe_del", False): | |
| _orig_loop_del = asyncio.base_events.BaseEventLoop.__del__ | |
| def _safe_loop_del(self) -> None: | |
| try: | |
| _orig_loop_del(self) | |
| except (ValueError, RuntimeError): | |
| pass | |
| asyncio.base_events.BaseEventLoop.__del__ = _safe_loop_del | |
| asyncio.base_events.BaseEventLoop._finsight_safe_del = True | |
| warnings.filterwarnings("ignore", message=".*HTTP_422_UNPROCESSABLE_ENTITY.*") | |
| from pathlib import Path | |
| backend_dir = Path(__file__).parent / "backend" | |
| sys.path.insert(0, str(backend_dir)) | |
| from gradio_ui.app import create_demo, launch_demo | |
| demo, theme, css = create_demo() | |
| if __name__ == "__main__": | |
| launch_demo(demo, theme, css) | |