|
1 | | -from typing import Callable, List, Union |
2 | | -from urllib.parse import urljoin |
3 | | - |
4 | 1 | import re |
5 | 2 | import httpx |
6 | 3 | import json |
7 | | -import pandas as pd |
8 | 4 | import requests |
9 | 5 | import uvicorn |
10 | 6 | import os |
11 | 7 | import subprocess |
| 8 | +import logging |
| 9 | +import pandas as pd |
12 | 10 | from fastapi import FastAPI, Request, testclient |
13 | 11 | from fastapi.exceptions import RequestValidationError |
14 | 12 | from fastapi.openapi.utils import get_openapi |
15 | | -from fastapi.responses import HTMLResponse, RedirectResponse |
16 | | -from fastapi.responses import PlainTextResponse |
| 13 | +from fastapi.responses import HTMLResponse, RedirectResponse, PlainTextResponse |
17 | 14 | from textwrap import dedent |
18 | 15 | from warnings import warn |
| 16 | +from urllib.parse import urljoin |
| 17 | +from typing import Callable, List, Union |
19 | 18 |
|
20 | | -from .utils import _jupyter_nb |
| 19 | +from .utils import _jupyter_nb, inform |
21 | 20 | from .vetiver_model import VetiverModel |
22 | 21 | from .meta import VetiverMeta |
23 | 22 | from .helpers import api_data_to_frame, response_to_frame |
24 | 23 |
|
| 24 | +_log = logging.getLogger(__name__) |
| 25 | + |
25 | 26 |
|
26 | 27 | class VetiverAPI: |
27 | 28 | """Create model aware API |
@@ -278,9 +279,10 @@ def run(self, port: int = 8000, host: str = "127.0.0.1", **kw): |
278 | 279 | ) |
279 | 280 | # subprocess is run, new URL given |
280 | 281 | if len(path) > 0: |
281 | | - print(f"INFO: vetiver running at: {path}") |
| 282 | + inform(_log, f"INFO: vetiver running at: {path}") |
282 | 283 | uvicorn.run(self.app, port=port, host=host, root_path=path, **kw) |
283 | 284 | else: |
| 285 | + inform(_log, f"INFO: vetiver running at: {host+':'+port}") |
284 | 286 | uvicorn.run(self.app, port=port, host=host, **kw) |
285 | 287 |
|
286 | 288 | def _custom_openapi(self): |
|
0 commit comments