Spaces:
Sleeping
Sleeping
feat: deploy latest SNAP Gradio SDK demo connected to snap_cpp
Browse files
app.py
CHANGED
|
@@ -60,6 +60,15 @@ except Exception as e:
|
|
| 60 |
print(f"[SNAP C++ Engine] Download failed: {e}. Falling back to local './models'")
|
| 61 |
weights_dir = "./models"
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
# Pre-create C++ engine instances per language
|
| 64 |
handles = {}
|
| 65 |
if snap_lib:
|
|
@@ -119,7 +128,7 @@ demo = gr.Interface(
|
|
| 119 |
description="""
|
| 120 |
### Zero Python Code Exposure — Powered by C++ Shared Library (`libsnap_cpp.so`)
|
| 121 |
- **GitHub Repository**: [https://github.com/snap-libs/snap_cpp](https://github.com/snap-libs/snap_cpp)
|
| 122 |
-
- **Model Hub**: [https://huggingface.co/softguy777/snap-weights](https://huggingface.co/snap-weights)
|
| 123 |
""",
|
| 124 |
article="""
|
| 125 |
<p style='text-align: center'>
|
|
|
|
| 60 |
print(f"[SNAP C++ Engine] Download failed: {e}. Falling back to local './models'")
|
| 61 |
weights_dir = "./models"
|
| 62 |
|
| 63 |
+
# Ensure 'models' folder alias mapping for C++ Strict Policy Anchor
|
| 64 |
+
models_alias = os.path.join(weights_dir, "models")
|
| 65 |
+
if not os.path.exists(models_alias) and os.path.exists(os.path.join(weights_dir, "ko")):
|
| 66 |
+
try:
|
| 67 |
+
os.symlink(weights_dir, models_alias, target_is_directory=True)
|
| 68 |
+
print("[SNAP C++ Engine] Created 'models' symlink mapping for strict C++ path anchor.")
|
| 69 |
+
except Exception as sym_err:
|
| 70 |
+
print(f"[SNAP C++ Engine] Symlink creation notice: {sym_err}")
|
| 71 |
+
|
| 72 |
# Pre-create C++ engine instances per language
|
| 73 |
handles = {}
|
| 74 |
if snap_lib:
|
|
|
|
| 128 |
description="""
|
| 129 |
### Zero Python Code Exposure — Powered by C++ Shared Library (`libsnap_cpp.so`)
|
| 130 |
- **GitHub Repository**: [https://github.com/snap-libs/snap_cpp](https://github.com/snap-libs/snap_cpp)
|
| 131 |
+
- **Model Hub**: [https://huggingface.co/softguy777/snap-weights](https://huggingface.co/softguy777/snap-weights)
|
| 132 |
""",
|
| 133 |
article="""
|
| 134 |
<p style='text-align: center'>
|