Skip to content
Snippets Groups Projects
Commit 0bad9c36 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Update documentation

parent d30ad6b0
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,8 @@ pip install -r models.txt
(venv)$ uvicorn app.main:app --reload
```
The server application is available on `http://localhost:8000`. To see the endpoint documentation, go to `http://localhost:8000/docs`
## Troubleshooting for Mac users
2023-02-14: When running the app locally on a Mac, this error occured when calling the /models endpoint:
......
from fastapi import FastAPI, Response, status
from fastapi.responses import PlainTextResponse
from fastapi.responses import PlainTextResponse, HTMLResponse
from app.internal.model_factory import *
from vipscore_common.vips_model import VIPSModel
from vipscore_common.entities import ModelConfiguration, Result
......@@ -24,9 +24,9 @@ app = FastAPI(
)
# TODO Create a nice welcome page
@app.get("/")
@app.get("/", response_class=HTMLResponse)
async def root():
return {"message": "Hello World"}
return _welcome_html
####### Model listing endpoints #######
......@@ -181,4 +181,20 @@ def _result_or_404(result, model_id:str, response:Response):
return result
else:
response.status_code = status.HTTP_404_NOT_FOUND
return {"ERROR":"VIPS model with id=%s could not be found." % model_id}
\ No newline at end of file
return {"ERROR":"VIPS model with id=%s could not be found." % model_id}
_welcome_html = """
<html>
<head>
<title>VIPSCore-Python</title>
</head>
<body>
<h1>VIPSCore-Python</h1>
<p>&copy; 2023 <a href="https://nibio.no/en" target="new">NIBIO</a></p>
<p>Python implementation of VIPSCore, to enable models written in Python.</p>
<p><a href="docs/">Endpoints documentation</a></p>
<p><a href="https://gitlab.nibio.no/VIPS/VIPSCore-Python" target="new">Source code on NIBIO's GitLab</a></p>
<p><a href="https://gitlab.nibio.no/VIPS/documentation" target="new">VIPS technical documentation</a></p>
<p><a href="https://nibio.no/en/subjects/plant-health/vips--a-digital-pest-prediction-platform" target="new">Read more about VIPS</a></p>
</body>
"""
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment