from fastapi import FastAPI from pydantic import BaseModel from ktp_reader import process_image app = FastAPI() class ImageData(BaseModel): image_path: str @app.post("/process_image/") def read_image(image_data: ImageData): try: # Use the provided image path image_path = image_data.image_path # Process the image using the image_path result = process_image(image_path) return result except Exception as e: return {"error": str(e)}