File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99import numpy as np
1010from typing import Callable , Union , List
1111
12+ from . import __version__
1213from .vetiver_model import VetiverModel
1314from .utils import _jupyter_nb
1415
@@ -47,7 +48,15 @@ def _init_app(self):
4748
4849 @app .get ("/" , include_in_schema = False )
4950 def docs_redirect ():
50- return RedirectResponse ("/__docs__" )
51+
52+ redirect = "__docs__"
53+
54+ return RedirectResponse (redirect )
55+
56+ if self .model .metadata .get ("url" ) is not None :
57+ @app .get ("/pin-url" )
58+ def pin_url ():
59+ return repr (self .model .metadata .get ("url" ))
5160
5261 @app .get ("/ping" , include_in_schema = True )
5362 async def ping ():
@@ -169,9 +178,10 @@ def _custom_openapi(self):
169178 return self .app .openapi_schema
170179 openapi_schema = get_openapi (
171180 title = self .model .model_name + " model API" ,
172- version = "0.1.3" ,
181+ version = __version__ ,
173182 description = self .model .description ,
174183 routes = self .app .routes ,
184+ servers = self .app .servers
175185 )
176186 openapi_schema ["info" ]["x-logo" ] = {"url" : "../docs/figures/logo.svg" }
177187 self .app .openapi_schema = openapi_schema
You can’t perform that action at this time.
0 commit comments