Spaces:
Running on Zero
Running on Zero
Filter known Gradio cleanup warning
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import importlib
|
|
| 5 |
import importlib.util
|
| 6 |
import json
|
| 7 |
import os
|
|
|
|
| 8 |
import tempfile
|
| 9 |
import time
|
| 10 |
from dataclasses import dataclass
|
|
@@ -16,6 +17,20 @@ import numpy as np
|
|
| 16 |
os.environ.setdefault("HF_HUB_ENABLE_HF_TRANSFER", "1")
|
| 17 |
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
@dataclass(frozen=True)
|
| 20 |
class GenerationModel:
|
| 21 |
label: str
|
|
|
|
| 5 |
import importlib.util
|
| 6 |
import json
|
| 7 |
import os
|
| 8 |
+
import sys
|
| 9 |
import tempfile
|
| 10 |
import time
|
| 11 |
from dataclasses import dataclass
|
|
|
|
| 17 |
os.environ.setdefault("HF_HUB_ENABLE_HF_TRANSFER", "1")
|
| 18 |
|
| 19 |
|
| 20 |
+
def _filter_known_unraisable(unraisable):
|
| 21 |
+
object_name = getattr(unraisable.object, "__qualname__", "")
|
| 22 |
+
if (
|
| 23 |
+
object_name == "BaseEventLoop.__del__"
|
| 24 |
+
and isinstance(unraisable.exc_value, ValueError)
|
| 25 |
+
and "Invalid file descriptor" in str(unraisable.exc_value)
|
| 26 |
+
):
|
| 27 |
+
return
|
| 28 |
+
sys.__unraisablehook__(unraisable)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
sys.unraisablehook = _filter_known_unraisable
|
| 32 |
+
|
| 33 |
+
|
| 34 |
@dataclass(frozen=True)
|
| 35 |
class GenerationModel:
|
| 36 |
label: str
|