AnimeOverlord commited on
Commit
23d298b
·
1 Parent(s): d4d8b51

Suppress asyncio cleanup warning

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -6,6 +6,7 @@ Beautiful Minecraft-themed Gradio UI with a dummy inference function
6
  """
7
 
8
  import os
 
9
  import torch
10
  import gradio as gr
11
  import spaces
@@ -13,6 +14,25 @@ from PIL import Image
13
  from huggingface_hub import snapshot_download
14
  from diffusers import DiffusionPipeline
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  # ----------------------------------------------------------------------
17
  # CUSTOM MINECRAFT CSS — THE ULTIMATE THEME
18
  # ----------------------------------------------------------------------
 
6
  """
7
 
8
  import os
9
+ import sys
10
  import torch
11
  import gradio as gr
12
  import spaces
 
14
  from huggingface_hub import snapshot_download
15
  from diffusers import DiffusionPipeline
16
 
17
+ _original_unraisablehook = sys.unraisablehook
18
+
19
+
20
+ def _ignore_asyncio_closed_fd_warning(unraisable):
21
+ object_name = getattr(unraisable.object, "__qualname__", "")
22
+ is_asyncio_loop_cleanup = object_name == "BaseEventLoop.__del__"
23
+ is_closed_fd_warning = (
24
+ unraisable.exc_type is ValueError
25
+ and "Invalid file descriptor: -1" in str(unraisable.exc_value)
26
+ )
27
+
28
+ if is_asyncio_loop_cleanup and is_closed_fd_warning:
29
+ return
30
+
31
+ _original_unraisablehook(unraisable)
32
+
33
+
34
+ sys.unraisablehook = _ignore_asyncio_closed_fd_warning
35
+
36
  # ----------------------------------------------------------------------
37
  # CUSTOM MINECRAFT CSS — THE ULTIMATE THEME
38
  # ----------------------------------------------------------------------