Upload app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
| 2 |
|
| 3 |
import ast
|
| 4 |
import os
|
|
|
|
| 5 |
from functools import lru_cache
|
| 6 |
from typing import Any, Dict, Iterator, List, Tuple
|
| 7 |
|
|
@@ -9,6 +10,21 @@ import gradio as gr
|
|
| 9 |
from huggingface_hub import hf_hub_download, list_repo_files
|
| 10 |
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
MODEL_REPO = os.getenv("MODEL_REPO", "luezr/moonkaAI")
|
| 13 |
GGUF_FILENAME = os.getenv("GGUF_FILENAME", "Qwen2.5-1.5B-Instruct.Q4_K_M.gguf")
|
| 14 |
HF_TOKEN = os.getenv("HF_TOKEN") or None
|
|
|
|
| 2 |
|
| 3 |
import ast
|
| 4 |
import os
|
| 5 |
+
import sys
|
| 6 |
from functools import lru_cache
|
| 7 |
from typing import Any, Dict, Iterator, List, Tuple
|
| 8 |
|
|
|
|
| 10 |
from huggingface_hub import hf_hub_download, list_repo_files
|
| 11 |
|
| 12 |
|
| 13 |
+
def suppress_asyncio_shutdown_noise(unraisable: Any) -> None:
|
| 14 |
+
obj_name = getattr(unraisable.object, "__qualname__", "")
|
| 15 |
+
exc = unraisable.exc_value
|
| 16 |
+
if (
|
| 17 |
+
obj_name == "BaseEventLoop.__del__"
|
| 18 |
+
and isinstance(exc, ValueError)
|
| 19 |
+
and "Invalid file descriptor" in str(exc)
|
| 20 |
+
):
|
| 21 |
+
return
|
| 22 |
+
sys.__unraisablehook__(unraisable)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
sys.unraisablehook = suppress_asyncio_shutdown_noise
|
| 26 |
+
|
| 27 |
+
|
| 28 |
MODEL_REPO = os.getenv("MODEL_REPO", "luezr/moonkaAI")
|
| 29 |
GGUF_FILENAME = os.getenv("GGUF_FILENAME", "Qwen2.5-1.5B-Instruct.Q4_K_M.gguf")
|
| 30 |
HF_TOKEN = os.getenv("HF_TOKEN") or None
|