async def get(self, request): return HTMLResponse(html)
async def get(computer: str): return HTMLResponse(html % computer)
def index(request): html = path / 'view' / 'index.html' return HTMLResponse(html.open().read())
async def get_message(request): return HTMLResponse(json.dumps({"msg": "Hello World"}))
async def homepage(request): html_file = path / "view" / "index.html" return HTMLResponse(html_file.open().read())
def api_info(): with open("./static/api_info.html", "r") as page_file: html_content = page_file.read() return HTMLResponse(content=html_content)
async def swagger_doc_handler(request): return HTMLResponse(content=doc.doc_html, media_type='text/html')
async def _(_): return HTMLResponse("<pre>not found</pre>", status_code=404)
def form(request): return HTMLResponse( """ <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <!-- jQuery library --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <!-- Popper JS --> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> <!-- Latest compiled JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script> <title>Detect Eye Diseases</title> </head> <body> <div class="container-fluid"> <div class="row"> <div class="col-md-2"> </div> <div class="col-md-8"> <h1>Detect Eye Diseases with Deep Learning Technology</h1> <h2>This example is based on the fast.ai deep learning framework: <a href="https://www.fast.ai/">https://www.fast.ai/</a></h2> <p><strong>Image classifier that detects different categories of eye diseases:<strong> <ul class="list-group"> <li class="list-group-item">Normal Eye</li> <li class="list-group-item">Glaucoma</li> <li class="list-group-item">Retina Disease</li> <li class="list-group-item">Cataract</li> </ul> </p> <form action="/upload" method="post" enctype="multipart/form-data"> <div class="form-group"> Select image to upload: <input type="file" name="file" class="input-sm"> <input type="submit" value="Upload and Analyze Image" class="btn btn-primary"> </div> </form> </div> <div class="col-md-2"> </div> </div> <div class="row"> <div class="col-md-2"> </div> <div class="col-md-8"> Or submit a URL: <form action="/classify-url" method="get"> <div class="form-group"> <input type="url" name="url" class="input-sm"> <input type="submit" value="Fetch and Analyze image" class="btn btn-primary"> </div> </form> </div> <div class="col-md-2"> </div> </div> </div> </body> </html> """)
def index(request): html = path / 'view/index.html' return HTMLResponse(open(html).read())
def root(): return HTMLResponse( pkg_resources.resource_string(__name__, "static/index.html"))
def home(request): # return render_template("index.html") html_file = path / 'templates' / 'index.html' return HTMLResponse(html_file.open().read())
async def progress(request): template = app.get_template('index.html') content = template.render(request=request) return HTMLResponse(content)
async def get(): return HTMLResponse(html)
def root(): with open("./static/index_2.html", "r") as page_file: html_content = page_file.read() return HTMLResponse(content=html_content)
def root(): with open('/app/app/static/index.html') as f: return HTMLResponse(content=f.read(), status_code=200)
def show_tutorial(): with open("./static/tutorial.html", "r") as page_file: html_content = page_file.read() return HTMLResponse(content=html_content)
async def handle_graphiql(self, request: Request) -> Response: text = GRAPHIQL.replace("{{REQUEST_PATH}}", json.dumps(request.url.path)) return HTMLResponse(text)
def get_graphiql_response(self) -> HTMLResponse: html = get_graphiql_html() return HTMLResponse(html)
def index(request): html = path / "view" / "index.html" return HTMLResponse(html.open().read())
async def index(): return HTMLResponse(index_html)
async def index(request): data = await get_data() if not data: return HTMLResponse(content="<body></body", status_code=424) return templates.TemplateResponse("index.html", {"request": request, "data": data})
async def get(): #return HTMLResponse(html) return HTMLResponse(html_ps)
async def render_playground( # pylint: disable=unused-argument self, request: Request) -> Response: return HTMLResponse(PLAYGROUND_HTML)
async def breeds(request): html_file = path / 'view' / 'breeds.html' return HTMLResponse(html_file.open().read())
def form(request): index_html = path / 'static' / 'index.html' return HTMLResponse(index_html.open().read())
def get_swagger_ui_oauth2_redirect_html() -> HTMLResponse: html = """ <!DOCTYPE html> <html lang="en-US"> <body onload="run()"> </body> </html> <script> 'use strict'; function run () { var oauth2 = window.opener.swaggerUIRedirectOauth2; var sentState = oauth2.state; var redirectUrl = oauth2.redirectUrl; var isValid, qp, arr; if (/code|token|error/.test(window.location.hash)) { qp = window.location.hash.substring(1); } else { qp = location.search.substring(1); } arr = qp.split("&") arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';}) qp = qp ? JSON.parse('{' + arr.join() + '}', function (key, value) { return key === "" ? value : decodeURIComponent(value) } ) : {} isValid = qp.state === sentState if (( oauth2.auth.schema.get("flow") === "accessCode"|| oauth2.auth.schema.get("flow") === "authorizationCode" ) && !oauth2.auth.code) { if (!isValid) { oauth2.errCb({ authId: oauth2.auth.name, source: "auth", level: "warning", message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server" }); } if (qp.code) { delete oauth2.state; oauth2.auth.code = qp.code; oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl}); } else { let oauthErrorMsg if (qp.error) { oauthErrorMsg = "["+qp.error+"]: " + (qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") + (qp.error_uri ? "More info: "+qp.error_uri : ""); } oauth2.errCb({ authId: oauth2.auth.name, source: "auth", level: "error", message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server" }); } } else { oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl}); } window.close(); } </script> """ return HTMLResponse(content=html)
def wrapped(request: Request, *args, **kwargs): data = fn(request, *args, **kwargs) if "ui" in request.query_params: return HTMLResponse(template(data)) return data
async def homepage(request): html_file = path / 'view' / 'index.html' return HTMLResponse(html_file.open().read())
async def html(request): """Return HTML content and a custom header.""" content = "<b>HTML OK</b>" headers = {'x-time': f"{time.time()}"} return HTMLResponse(content, headers=headers)