Spaces:
Sleeping
Sleeping
CI: Sync tiny-only from GitHub bc46741
Browse files- README.md +5 -9
- sam2_server/src/main.rs +2 -1
- sam2_server/static/index.html +2 -2
README.md
CHANGED
|
@@ -49,7 +49,7 @@ Option A β Cargo (development):
|
|
| 49 |
1) Ensure Rust is installed
|
| 50 |
2) From the repo root, run:
|
| 51 |
- cargo run -p sam2_server
|
| 52 |
-
3) Open http://127.0.0.1:8080
|
| 53 |
|
| 54 |
Option B β Docker:
|
| 55 |
1) Build
|
|
@@ -59,13 +59,13 @@ Option B β Docker:
|
|
| 59 |
3) Open http://localhost:8080
|
| 60 |
|
| 61 |
Notes
|
| 62 |
-
- The server
|
| 63 |
|
| 64 |
|
| 65 |
## API
|
| 66 |
Base URL
|
| 67 |
- Local: http://127.0.0.1:8080
|
| 68 |
-
- In the Space: / (container root)
|
| 69 |
- Swagger: /docs
|
| 70 |
|
| 71 |
Endpoints
|
|
@@ -109,12 +109,8 @@ Example curl
|
|
| 109 |
|
| 110 |
|
| 111 |
## Models
|
| 112 |
-
- ONNX files
|
| 113 |
-
|
| 114 |
-
- sam2_small.onnx
|
| 115 |
-
- sam2_base_plus.onnx
|
| 116 |
-
- sam2_large.onnx
|
| 117 |
-
- The Dockerfile copies these into the image; the server automatically loads the requested size on first use and caches it.
|
| 118 |
|
| 119 |
|
| 120 |
## Tech stack
|
|
|
|
| 49 |
1) Ensure Rust is installed
|
| 50 |
2) From the repo root, run:
|
| 51 |
- cargo run -p sam2_server
|
| 52 |
+
3) Open http://127.0.0.1:8080 (binds to 0.0.0.0:8080 in containers and Spaces)
|
| 53 |
|
| 54 |
Option B β Docker:
|
| 55 |
1) Build
|
|
|
|
| 59 |
3) Open http://localhost:8080
|
| 60 |
|
| 61 |
Notes
|
| 62 |
+
- The server now binds to 0.0.0.0 and honors the PORT env var in containers/Spaces (defaults to 8080 locally). This makes it reachable behind the Spaces proxy.
|
| 63 |
|
| 64 |
|
| 65 |
## API
|
| 66 |
Base URL
|
| 67 |
- Local: http://127.0.0.1:8080
|
| 68 |
+
- In the Space: / (container root) β server binds 0.0.0.0 and will respect PORT
|
| 69 |
- Swagger: /docs
|
| 70 |
|
| 71 |
Endpoints
|
|
|
|
| 109 |
|
| 110 |
|
| 111 |
## Models
|
| 112 |
+
- ONNX files available in the repository root. For the free Space deployment we include only sam2_tiny.onnx to stay under the 1 GB Space limit.
|
| 113 |
+
- The Dockerfile copies sam2_tiny.onnx into the image; the server loads it on first use and caches it.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
|
| 116 |
## Tech stack
|
sam2_server/src/main.rs
CHANGED
|
@@ -426,7 +426,8 @@ async fn main() -> Result<()> {
|
|
| 426 |
.layer(prometheus_layer)
|
| 427 |
.with_state(state);
|
| 428 |
|
| 429 |
-
let
|
|
|
|
| 430 |
info!("server listening on http://{}", addr);
|
| 431 |
axum::serve(tokio::net::TcpListener::bind(addr).await?, app).await?;
|
| 432 |
Ok(())
|
|
|
|
| 426 |
.layer(prometheus_layer)
|
| 427 |
.with_state(state);
|
| 428 |
|
| 429 |
+
let port: u16 = std::env::var("PORT").ok().and_then(|s| s.parse().ok()).unwrap_or(8080);
|
| 430 |
+
let addr = std::net::SocketAddr::from(([0, 0, 0, 0], port));
|
| 431 |
info!("server listening on http://{}", addr);
|
| 432 |
axum::serve(tokio::net::TcpListener::bind(addr).await?, app).await?;
|
| 433 |
Ok(())
|
sam2_server/static/index.html
CHANGED
|
@@ -314,10 +314,10 @@
|
|
| 314 |
<div class="row row-model">
|
| 315 |
<label>Model:
|
| 316 |
<select id="model">
|
| 317 |
-
<option value="Tiny">Tiny</option>
|
| 318 |
<option value="Small">Small</option>
|
| 319 |
<option value="BasePlus">BasePlus</option>
|
| 320 |
-
<option value="Large"
|
| 321 |
</select>
|
| 322 |
</label>
|
| 323 |
</div>
|
|
|
|
| 314 |
<div class="row row-model">
|
| 315 |
<label>Model:
|
| 316 |
<select id="model">
|
| 317 |
+
<option value="Tiny" selected>Tiny</option>
|
| 318 |
<option value="Small">Small</option>
|
| 319 |
<option value="BasePlus">BasePlus</option>
|
| 320 |
+
<option value="Large">Large</option>
|
| 321 |
</select>
|
| 322 |
</label>
|
| 323 |
</div>
|