Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
from PIL import Image
|
| 3 |
from RealESRGAN import RealESRGAN
|
|
@@ -82,5 +102,6 @@ with gr.Blocks() as demo:
|
|
| 82 |
|
| 83 |
gr.Markdown(article)
|
| 84 |
|
| 85 |
-
#
|
| 86 |
-
|
|
|
|
|
|
| 1 |
+
# --- MONKEY PATCH: MENAMBAL BUG INTERNAL GRADIO_CLIENT ---
|
| 2 |
+
import gradio_client.utils
|
| 3 |
+
|
| 4 |
+
if hasattr(gradio_client.utils, 'get_type'):
|
| 5 |
+
_original_get_type = gradio_client.utils.get_type
|
| 6 |
+
def _patched_get_type(schema):
|
| 7 |
+
if isinstance(schema, bool):
|
| 8 |
+
return "bool"
|
| 9 |
+
return _original_get_type(schema)
|
| 10 |
+
gradio_client.utils.get_type = _patched_get_type
|
| 11 |
+
|
| 12 |
+
if hasattr(gradio_client.utils, '_json_schema_to_python_type'):
|
| 13 |
+
_original_json_schema = gradio_client.utils._json_schema_to_python_type
|
| 14 |
+
def _patched_json_schema(schema, defs=None):
|
| 15 |
+
if isinstance(schema, bool):
|
| 16 |
+
return "bool"
|
| 17 |
+
return _original_json_schema(schema, defs)
|
| 18 |
+
gradio_client.utils._json_schema_to_python_type = _patched_json_schema
|
| 19 |
+
# ---------------------------------------------------------
|
| 20 |
+
|
| 21 |
import torch
|
| 22 |
from PIL import Image
|
| 23 |
from RealESRGAN import RealESRGAN
|
|
|
|
| 102 |
|
| 103 |
gr.Markdown(article)
|
| 104 |
|
| 105 |
+
# PENTING: Jangan gunakan server_name/server_port manual di Hugging Face Spaces.
|
| 106 |
+
# Biarkan Spaces mengaturnya secara otomatis untuk menghindari error 'localhost not accessible'.
|
| 107 |
+
demo.queue().launch(show_error=True)
|