Spaces:
Sleeping
Sleeping
ibcplateformes Claude Opus 4.6 commited on
Commit ·
9ff3bb8
1
Parent(s): 554bffb
Upgrade to Gradio 5.12.0 for proper ZeroGPU authentication
Browse filesGradio 4.44.0 doesn't properly pass auth cookies for ZeroGPU,
causing "Unlogged user" errors even when the user is logged in.
Gradio 5.12.0+ fixes this. Also:
- Removed all gradio 4.44.0 monkey-patches (no longer needed)
- Removed starlette pin (no longer needed)
- Restored @spaces.GPU on separation and inference
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- README.md +1 -1
- app.py +0 -45
- pipeline/inference.py +1 -0
- pipeline/separation.py +1 -0
- requirements.txt +1 -2
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: "\U0001F3A4"
|
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
python_version: "3.10"
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.12.0
|
| 8 |
python_version: "3.10"
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
app.py
CHANGED
|
@@ -11,51 +11,6 @@ import shutil
|
|
| 11 |
|
| 12 |
import gradio as gr
|
| 13 |
|
| 14 |
-
# ── Monkey-patch gradio_client schema parsing bugs ──────────────────────────
|
| 15 |
-
# get_type() and _json_schema_to_python_type() crash when schema is a bool.
|
| 16 |
-
try:
|
| 17 |
-
import gradio_client.utils as _gc_utils
|
| 18 |
-
|
| 19 |
-
_original_get_type = _gc_utils.get_type
|
| 20 |
-
|
| 21 |
-
def _patched_get_type(schema):
|
| 22 |
-
if isinstance(schema, bool):
|
| 23 |
-
return "Any"
|
| 24 |
-
try:
|
| 25 |
-
return _original_get_type(schema)
|
| 26 |
-
except TypeError:
|
| 27 |
-
return "Any"
|
| 28 |
-
|
| 29 |
-
_gc_utils.get_type = _patched_get_type
|
| 30 |
-
|
| 31 |
-
_original_json_schema = _gc_utils._json_schema_to_python_type
|
| 32 |
-
|
| 33 |
-
def _patched_json_schema(schema, defs=None):
|
| 34 |
-
if isinstance(schema, bool):
|
| 35 |
-
return "Any"
|
| 36 |
-
try:
|
| 37 |
-
return _original_json_schema(schema, defs)
|
| 38 |
-
except TypeError:
|
| 39 |
-
return "Any"
|
| 40 |
-
|
| 41 |
-
_gc_utils._json_schema_to_python_type = _patched_json_schema
|
| 42 |
-
except Exception:
|
| 43 |
-
pass
|
| 44 |
-
|
| 45 |
-
# Safety net: patch Blocks.get_api_info to prevent TypeError propagation.
|
| 46 |
-
try:
|
| 47 |
-
_orig_get_api_info = gr.Blocks.get_api_info
|
| 48 |
-
|
| 49 |
-
def _safe_get_api_info(self, *args, **kwargs):
|
| 50 |
-
try:
|
| 51 |
-
return _orig_get_api_info(self, *args, **kwargs)
|
| 52 |
-
except TypeError:
|
| 53 |
-
return {"named_endpoints": {}, "unnamed_endpoints": {}}
|
| 54 |
-
|
| 55 |
-
gr.Blocks.get_api_info = _safe_get_api_info
|
| 56 |
-
except Exception:
|
| 57 |
-
pass
|
| 58 |
-
|
| 59 |
# Setup logging
|
| 60 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
|
| 61 |
logger = logging.getLogger(__name__)
|
|
|
|
| 11 |
|
| 12 |
import gradio as gr
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Setup logging
|
| 15 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
|
| 16 |
logger = logging.getLogger(__name__)
|
pipeline/inference.py
CHANGED
|
@@ -26,6 +26,7 @@ from pipeline.setup import APPLIO_DIR, ensure_applio_path
|
|
| 26 |
OUTPUT_DIR = "/tmp/rvc_output"
|
| 27 |
|
| 28 |
|
|
|
|
| 29 |
def convert_voice(
|
| 30 |
audio_path: str,
|
| 31 |
model_path: str,
|
|
|
|
| 26 |
OUTPUT_DIR = "/tmp/rvc_output"
|
| 27 |
|
| 28 |
|
| 29 |
+
@spaces.GPU(duration=60)
|
| 30 |
def convert_voice(
|
| 31 |
audio_path: str,
|
| 32 |
model_path: str,
|
pipeline/separation.py
CHANGED
|
@@ -22,6 +22,7 @@ except ImportError:
|
|
| 22 |
OUTPUT_DIR = "/tmp/demucs_output"
|
| 23 |
|
| 24 |
|
|
|
|
| 25 |
def separate_audio(audio_path: str, model_name: str = "htdemucs"):
|
| 26 |
"""
|
| 27 |
Separate audio into vocals and instruments using Demucs.
|
|
|
|
| 22 |
OUTPUT_DIR = "/tmp/demucs_output"
|
| 23 |
|
| 24 |
|
| 25 |
+
@spaces.GPU(duration=60)
|
| 26 |
def separate_audio(audio_path: str, model_name: str = "htdemucs"):
|
| 27 |
"""
|
| 28 |
Separate audio into vocals and instruments using Demucs.
|
requirements.txt
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
# Gradio + HuggingFace
|
| 2 |
-
gradio=
|
| 3 |
-
starlette<0.38.0
|
| 4 |
spaces
|
| 5 |
huggingface_hub>=0.23.0
|
| 6 |
|
|
|
|
| 1 |
# Gradio + HuggingFace
|
| 2 |
+
gradio>=5.12.0
|
|
|
|
| 3 |
spaces
|
| 4 |
huggingface_hub>=0.23.0
|
| 5 |
|