# Path: docker/payloads.py
# class CompletionPayload(BaseModel):
#     context: str
#     temp: Optional[float] = 1.0
#     top_p: Optional[float] = 0.9
#     top_k: Optional[int] = 50
#     length: Optional[int] = 256
# 
# class CompletionResponse(BaseModel):
#     context: str
#     completion: str
#     time: float
# 
# class QueueRequest(BaseModel):
#     qid: int
# 
# class QueueResponse(BaseModel):
#     qid: int
# 
# Path: docker/ops.py
# def get_gptj_model():
#     compile_model()
#     return gptj_model


import uvicorn
import traceback
import logging
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from .payloads import CompletionPayload, CompletionResponse, QueueRequest, QueueResponse
from .ops import get_gptj_model




logger = logging.getLogger(__name__)

app = FastAPI()
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)


# globals

# Path: docker/payloads.py
# class CompletionPayload(BaseModel):
#     context: str
#     temp: Optional[float] = 1.0
#     top_p: Optional[float] = 0.9
#     top_k: Optional[int] = 50
#     length: Optional[int] = 256
# 
# class CompletionResponse(BaseModel):
#     context: str
#     completion: str
#     time: float
# 
# class QueueRequest(BaseModel):
#     qid: int
# 
# class QueueResponse(BaseModel):
#     qid: int
# 
# Path: docker/ops.py
# def get_gptj_model():
#     compile_model()
#     return gptj_model


# Path: docker/main.py
import uvicorn
import traceback
import logging
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from .payloads import CompletionPayload, CompletionResponse, QueueRequest, QueueResponse
from .ops import get_gptj_model





logger = logging.getLogger(__name__)

app = FastAPI()
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)


# globals

MODEL_API = None