File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 9
9
import numpy as np
10
10
from typing import Callable , Union , List
11
11
12
+ from . import __version__
12
13
from .vetiver_model import VetiverModel
13
14
from .utils import _jupyter_nb
14
15
@@ -47,7 +48,15 @@ def _init_app(self):
47
48
48
49
@app .get ("/" , include_in_schema = False )
49
50
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" ))
51
60
52
61
@app .get ("/ping" , include_in_schema = True )
53
62
async def ping ():
@@ -169,9 +178,10 @@ def _custom_openapi(self):
169
178
return self .app .openapi_schema
170
179
openapi_schema = get_openapi (
171
180
title = self .model .model_name + " model API" ,
172
- version = "0.1.3" ,
181
+ version = __version__ ,
173
182
description = self .model .description ,
174
183
routes = self .app .routes ,
184
+ servers = self .app .servers
175
185
)
176
186
openapi_schema ["info" ]["x-logo" ] = {"url" : "../docs/figures/logo.svg" }
177
187
self .app .openapi_schema = openapi_schema
You can’t perform that action at this time.
0 commit comments