File size: 496 Bytes
db656f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)}