from typing import Optional, List
from fastapi import FastAPI, File, UploadFile, Request
from sqlmodel import Field, Session, SQLModel, create_engine, select
from pydantic import BaseModel
from network import Network
import requests
from PIL import Image as ImagePIL
import torchvision as tv

app = FastAPI()
network = Network()
network.model.eval()


class Image(SQLModel, table=True):
    key: Optional[int] = Field(default=None, primary_key=True)
    image_name: str
    label: str
    image_url: str

engine = create_engine("sqlite:///image.db")

@app.get("/")
def read_images():
    with Session(engine) as session:
        statement = 