Update Dockerfile to optimize application setup and streamline dependencies
Browse files- ai.py +1 -0
- main.py +5 -2
- sample.jpg → static/sample.jpg +0 -0
ai.py
CHANGED
@@ -109,4 +109,5 @@ def generate_cube(user_prompt: str) -> CubeAI:
|
|
109 |
)
|
110 |
chain = prompt | model
|
111 |
response = chain.invoke({"user_prompt": user_prompt})
|
|
|
112 |
return response
|
|
|
109 |
)
|
110 |
chain = prompt | model
|
111 |
response = chain.invoke({"user_prompt": user_prompt})
|
112 |
+
print(response.model_dump(mode='json'))
|
113 |
return response
|
main.py
CHANGED
@@ -11,6 +11,7 @@ import cv2
|
|
11 |
import numpy as np
|
12 |
from PIL import Image
|
13 |
from fastapi import FastAPI, HTTPException, UploadFile, File
|
|
|
14 |
from pydantic import BaseModel
|
15 |
from starlette.middleware.cors import CORSMiddleware
|
16 |
|
@@ -26,6 +27,8 @@ app.add_middleware(
|
|
26 |
allow_headers=["*"],
|
27 |
)
|
28 |
|
|
|
|
|
29 |
|
30 |
class LUTRequest(BaseModel):
|
31 |
file_id: str
|
@@ -390,7 +393,7 @@ async def transform_lut(request: LUTTransformRequest):
|
|
390 |
status_code=500, detail="Failed to save new cube file"
|
391 |
)
|
392 |
|
393 |
-
sample_image_path = "sample.jpg"
|
394 |
if not os.path.exists(sample_image_path):
|
395 |
raise HTTPException(status_code=404, detail="Sample image not found")
|
396 |
|
@@ -418,4 +421,4 @@ async def transform_lut(request: LUTTransformRequest):
|
|
418 |
|
419 |
@app.get("/health")
|
420 |
async def health_check():
|
421 |
-
return {"status": "healthy", "sample_image_exists": os.path.exists("sample.jpg")}
|
|
|
11 |
import numpy as np
|
12 |
from PIL import Image
|
13 |
from fastapi import FastAPI, HTTPException, UploadFile, File
|
14 |
+
from fastapi.staticfiles import StaticFiles
|
15 |
from pydantic import BaseModel
|
16 |
from starlette.middleware.cors import CORSMiddleware
|
17 |
|
|
|
27 |
allow_headers=["*"],
|
28 |
)
|
29 |
|
30 |
+
app.mount("/static", StaticFiles(directory="static"), name="static")
|
31 |
+
|
32 |
|
33 |
class LUTRequest(BaseModel):
|
34 |
file_id: str
|
|
|
393 |
status_code=500, detail="Failed to save new cube file"
|
394 |
)
|
395 |
|
396 |
+
sample_image_path = "static/sample.jpg"
|
397 |
if not os.path.exists(sample_image_path):
|
398 |
raise HTTPException(status_code=404, detail="Sample image not found")
|
399 |
|
|
|
421 |
|
422 |
@app.get("/health")
|
423 |
async def health_check():
|
424 |
+
return {"status": "healthy", "sample_image_exists": os.path.exists("static/sample.jpg")}
|
sample.jpg → static/sample.jpg
RENAMED
File without changes
|