Make startup logs UTF-8 safe
Browse files
app.py
CHANGED
|
@@ -4,9 +4,14 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
import hashlib
|
| 6 |
import json
|
|
|
|
| 7 |
import time
|
| 8 |
from pathlib import Path
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
import gradio as gr
|
| 11 |
import numpy as np
|
| 12 |
from PIL import Image
|
|
|
|
| 4 |
|
| 5 |
import hashlib
|
| 6 |
import json
|
| 7 |
+
import sys
|
| 8 |
import time
|
| 9 |
from pathlib import Path
|
| 10 |
|
| 11 |
+
for _stream in (sys.stdout, sys.stderr):
|
| 12 |
+
if hasattr(_stream, "reconfigure"):
|
| 13 |
+
_stream.reconfigure(encoding="utf-8", errors="replace")
|
| 14 |
+
|
| 15 |
import gradio as gr
|
| 16 |
import numpy as np
|
| 17 |
from PIL import Image
|