Files
gh-christianlouis-docuelevate/app/main.py
T
Christian Krakau-Louis 1ad9425102 Added first working version of the code. Processes
PDF files, no upload yet.
2025-02-11 19:42:23 +01:00

26 lines
663 B
Python

#!/usr/bin/env python3
from fastapi import FastAPI, HTTPException
from .tasks.upload_to_s3 import upload_to_s3
import os
app = FastAPI(title="Document Processing API")
@app.get("/")
def root():
return {"message": "Document Processing API"}
@app.post("/process/")
def process(file_path: str):
"""
API Endpoint to start document processing.
This enqueues the first task (upload_to_s3), which handles the full pipeline.
"""
if not os.path.exists(file_path):
raise HTTPException(status_code=400, detail=f"File {file_path} not found.")
task = upload_to_s3.delay(file_path)
return {"task_id": task.id, "status": "queued"}