-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fastapi, dockerfile & integrate into ci
- Loading branch information
Showing
5 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Define the base image | ||
FROM python:3.9 | ||
|
||
# Create a folder and copy the folder structure from local | ||
RUN mkdir -p /index | ||
|
||
COPY /index /index | ||
|
||
# Install API requirements | ||
COPY requirements.txt /tmp/ | ||
RUN pip install --requirement /tmp/requirements.txt | ||
|
||
EXPOSE 80 | ||
|
||
# API entry point | ||
CMD ["uvicorn", "index.api.routes:app", "--host", "0.0.0.0", "--port", "80"] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import logging | ||
|
||
from fastapi import FastAPI | ||
from starlette.middleware.cors import CORSMiddleware | ||
from starlette.responses import RedirectResponse | ||
|
||
app = FastAPI( | ||
title="INDEX", | ||
description="Intelligent data steward toolbox using Large Language Model embeddings " | ||
"for automated Data-Harmonization .", | ||
version="0.0.1", | ||
terms_of_service="https://www.scai.fraunhofer.de/", | ||
contact={ | ||
"name": "Dr. Marc Jacobs", | ||
"email": "[email protected]", | ||
}, | ||
license_info={ | ||
"name": "Apache 2.0", | ||
"url": "https://www.apache.org/licenses/LICENSE-2.0.html", | ||
}, | ||
) | ||
|
||
origins = ["*"] | ||
|
||
app.add_middleware( | ||
CORSMiddleware, | ||
allow_origins=origins, | ||
allow_credentials=True, | ||
allow_methods=["*"], | ||
allow_headers=["*"], | ||
) | ||
|
||
logger = logging.getLogger("uvicorn.info") | ||
|
||
|
||
@app.get("/", include_in_schema=False) | ||
def swagger_redirect(): | ||
return RedirectResponse(url='/docs') | ||
|
||
|
||
@app.get("/version", tags=["info"]) | ||
def get_current_version(): | ||
return app.version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters