Spaces:
Running on T4
Running on T4
github-actions[bot] commited on
Commit ·
bbc23ea
1
Parent(s): 413b142
Automated Deploy: 619649e9c7151b8b7cccec5ecedf3ec0b57b9d8d
Browse files- baseball_batting/api.py +1 -1
- tests/test_deployment_sync.py +31 -0
baseball_batting/api.py
CHANGED
|
@@ -76,7 +76,7 @@ def create_app(settings=None, service=None):
|
|
| 76 |
service.start()
|
| 77 |
try: yield
|
| 78 |
finally: service.stop()
|
| 79 |
-
app = FastAPI(title="Baseball Swing Engine and Coach", version="1.7.
|
| 80 |
description="GPU batting/load timing with separate bat keypoint and baseball models. Single-view visual contact; physical miss/shift require synchronized calibrated views. Accuracy validation pending.")
|
| 81 |
app.state.service = service
|
| 82 |
app.add_middleware(UploadGuard, settings=settings, service=service)
|
|
|
|
| 76 |
service.start()
|
| 77 |
try: yield
|
| 78 |
finally: service.stop()
|
| 79 |
+
app = FastAPI(title="Baseball Swing Engine and Coach", version="1.7.1", lifespan=lifespan,
|
| 80 |
description="GPU batting/load timing with separate bat keypoint and baseball models. Single-view visual contact; physical miss/shift require synchronized calibrated views. Accuracy validation pending.")
|
| 81 |
app.state.service = service
|
| 82 |
app.add_middleware(UploadGuard, settings=settings, service=service)
|
tests/test_deployment_sync.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Exercise the deployment overlay with real files, including clone timestamp collisions."""
|
| 2 |
+
import os
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
import shlex
|
| 5 |
+
import shutil
|
| 6 |
+
import subprocess
|
| 7 |
+
|
| 8 |
+
import pytest
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def test_deployment_copies_same_size_changes_with_identical_timestamps(tmp_path):
|
| 12 |
+
rsync = shutil.which('rsync')
|
| 13 |
+
if not rsync:
|
| 14 |
+
pytest.skip('rsync is required by the deployment runner')
|
| 15 |
+
source, space = tmp_path/'source', tmp_path/'space'
|
| 16 |
+
source.mkdir(); space.mkdir()
|
| 17 |
+
new, old = source/'api.py', space/'api.py'
|
| 18 |
+
new.write_text('version="1.7.1"\n'); old.write_text('version="1.7.0"\n')
|
| 19 |
+
for file in (new, old):
|
| 20 |
+
os.utime(file, (1700000000, 1700000000))
|
| 21 |
+
assert new.stat().st_size == old.stat().st_size
|
| 22 |
+
# Space-only files must survive the overlay.
|
| 23 |
+
retained = space/'space-only.txt'
|
| 24 |
+
retained.write_text('keep')
|
| 25 |
+
workflow = Path(__file__).parents[1]/'.github/workflows/deploy-huggingface.yml'
|
| 26 |
+
command = next(line.strip() for line in workflow.read_text().splitlines()
|
| 27 |
+
if line.strip().startswith('rsync '))
|
| 28 |
+
arguments = shlex.split(command)
|
| 29 |
+
subprocess.run([rsync, *arguments[1:-2], str(source)+'/', str(space)+'/'], check=True)
|
| 30 |
+
assert old.read_bytes() == new.read_bytes()
|
| 31 |
+
assert retained.read_text() == 'keep'
|