Spaces:
Running
on
Zero
Running
on
Zero
ACE-Step Custom
commited on
Commit
·
55a1124
1
Parent(s):
ccb3542
Monkey patch get_api_info to prevent JSON schema errors
Browse files
app.py
CHANGED
|
@@ -658,22 +658,24 @@ if __name__ == "__main__":
|
|
| 658 |
# Create and launch app
|
| 659 |
app = create_ui()
|
| 660 |
|
| 661 |
-
#
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
|
| 672 |
-
|
| 673 |
-
|
| 674 |
-
|
| 675 |
-
|
| 676 |
-
|
|
|
|
|
|
|
| 677 |
app.launch(
|
| 678 |
server_name="0.0.0.0",
|
| 679 |
server_port=7860,
|
|
|
|
| 658 |
# Create and launch app
|
| 659 |
app = create_ui()
|
| 660 |
|
| 661 |
+
# Monkey patch the get_api_info method to prevent JSON schema errors
|
| 662 |
+
original_get_api_info = app.get_api_info
|
| 663 |
+
|
| 664 |
+
def safe_get_api_info(*args, **kwargs):
|
| 665 |
+
"""Patched get_api_info that returns minimal info to avoid schema errors"""
|
| 666 |
+
try:
|
| 667 |
+
return original_get_api_info(*args, **kwargs)
|
| 668 |
+
except (TypeError, AttributeError, KeyError) as e:
|
| 669 |
+
logger.warning(f"API info generation failed, returning minimal info: {e}")
|
| 670 |
+
return {
|
| 671 |
+
"named_endpoints": {},
|
| 672 |
+
"unnamed_endpoints": {}
|
| 673 |
+
}
|
| 674 |
+
|
| 675 |
+
app.get_api_info = safe_get_api_info
|
| 676 |
+
logger.info("✓ Patched get_api_info method")
|
| 677 |
+
|
| 678 |
+
# Launch the app
|
| 679 |
app.launch(
|
| 680 |
server_name="0.0.0.0",
|
| 681 |
server_port=7860,
|