image-play / main.py
ricardo238costa's picture
Create main.py
19ace95 verified
raw
history blame contribute delete
586 Bytes
from fastapi import FastAPI, Form
from typing import List
from pydantic import BaseModel
from src.model import similarity_model as model
from src.similarity.similarity import Similarity
app = FastAPI()
similarity = Similarity()
models = similarity.get_models()
class ImageInputs(BaseModel):
img_main: str
img_1: str
img_2: str
model_idx: int
@app.post("/check_similarity")
async def check_similarity(images: ImageInputs):
result = similarity.check_similarity([images.img_main, images.img_1, images.img_2], models[images.model_idx])
return {"result": result}