Skip to content

Commit

Permalink
adjust mnist url
Browse files Browse the repository at this point in the history
  • Loading branch information
Anemosx committed Jun 23, 2024
1 parent 20ed951 commit a84ca19
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles

from app.routers import base_router, predict_router
from app.routers import base_router, mnist_router
from app.vision.mnist import init_vision_model


Expand All @@ -31,7 +31,7 @@ async def lifespan(app: FastAPI):
)
mnist_app.mount("/static", StaticFiles(directory="static"), name="static")
mnist_app.include_router(base_router)
mnist_app.include_router(predict_router)
mnist_app.include_router(mnist_router)


async def init_model() -> None:
Expand Down
4 changes: 2 additions & 2 deletions app/routers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .base import router as base_router
from .predict import router as predict_router
from .mnist import router as mnist_router

BASE_ROUTERS = [base_router]
PREDICT_ROUTERS = [predict_router]
PREDICT_ROUTERS = [mnist_router]
2 changes: 1 addition & 1 deletion app/routers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
mnist_content = file.read()


@router.get("/", response_class=HTMLResponse)
@router.get("/mnist", response_class=HTMLResponse)
async def read_root() -> HTMLResponse:
"""
Serve the MNIST HTML page from the static directory.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/app/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TestBase:

@pytest.mark.asyncio
def test_get_root(self, client: TestClient) -> None:
response = client.get(f"/")
response = client.get(f"/mnist")

assert response.status_code == status.HTTP_200_OK
assert response.headers["Content-Type"] == "text/html; charset=utf-8"
Expand Down
2 changes: 1 addition & 1 deletion tests/app/test_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class TestPredictDigit:

@patch("app.routers.predict.predict_digit")
@patch("app.routers.mnist.predict_digit")
def test_predict_digit(
self, mock: MagicMock, client: TestClient, create_mnist_image: tuple[str, int]
) -> None:
Expand Down

0 comments on commit a84ca19

Please sign in to comment.