diff --git a/app/main.py b/app/main.py index 60ae7ea..b057313 100644 --- a/app/main.py +++ b/app/main.py @@ -1,40 +1,21 @@ -import os -import logging -from contextlib import asynccontextmanager - from fastapi import FastAPI -import sentry_sdk - -from app.api import text_extract, pdf_extract # updated -sentry_sdk.init( - dsn="https://5c74c0bf64424183a3d8fea7a803a9b0@o4505535984828416.ingest.sentry.io/4505535986335744", - traces_sample_rate=1.0, - profiles_sample_rate=1.0, - profiles_sampler=1.0, -) - -log = logging.getLogger("uvicorn") +from pydantic import BaseModel +import uvicorn -@asynccontextmanager -async def lifespan(app: FastAPI): - log.info("Starting up...") - yield - log.info("Shutting down...") +app = FastAPI() -def create_application() -> FastAPI: - application = FastAPI( - title="API_OCR", - version="0.1.0", - description="OCR API project using tesseract and fastapi", - contact={ - "name": "Fabio", - }, - lifespan=lifespan - ) - application.include_router(text_extract.router) - application.include_router(pdf_extract.router) +class Item(BaseModel): + name: str + description: str | None = None + price: float - return application +@app.get('/') +def read_root(): + return {'message': 'Welcome to the FastAPI app!'} +@app.post('/items/') +def create_item(item: Item): + return item -app = create_application() +if __name__ == '__main__': + uvicorn.run('main:app', host='127.0.0.1', port=8000, reload=True) \ No newline at end of file diff --git a/app/models.py b/app/models.py new file mode 100644 index 0000000..833d628 --- /dev/null +++ b/app/models.py @@ -0,0 +1,6 @@ +from pydantic import BaseModel + +class Item(BaseModel): + name: str + description: str | None = None + price: float \ No newline at end of file