retuve.app
Contains all the code for the front-end and API of the Retuve App.
Can be called using
retuve --task trak --keyphrase_file config.py
Swagger Documentaition for the API is coming soon.
1# Copyright 2024 Adam McArthur 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15""" 16Contains all the code for the front-end and API of the Retuve App. 17 18Can be called using 19 20```bash 21retuve --task trak --keyphrase_file config.py 22``` 23 24Swagger Documentaition for the API is coming soon. 25""" 26 27from fastapi import FastAPI, Request 28from fastapi.responses import RedirectResponse 29 30from retuve.app.utils import UnauthorizedException 31 32from .routes.api import router as routes_app 33from .routes.live import router as live_app 34from .routes.models import router as models_app 35from .routes.ui import router as web_app 36 37app = FastAPI() 38 39 40@app.exception_handler(UnauthorizedException) 41async def unauthorized_exception_handler( 42 request: Request, exc: UnauthorizedException 43): 44 # 303 = “See Other” 45 return RedirectResponse(url="/", status_code=303) 46 47 48app.include_router(routes_app) 49app.include_router(models_app) 50app.include_router(web_app) 51app.include_router(live_app)
app =
<fastapi.applications.FastAPI object>