feat: process image before converting it to 3d
Browse files
app.py
CHANGED
@@ -299,7 +299,7 @@ import tempfile
|
|
299 |
|
300 |
app = FastAPI()
|
301 |
|
302 |
-
@app.post("/
|
303 |
async def generate_3d(image: UploadFile = File(...)):
|
304 |
if not image:
|
305 |
raise HTTPException(status_code=400, detail="No image provided")
|
@@ -307,7 +307,7 @@ async def generate_3d(image: UploadFile = File(...)):
|
|
307 |
try:
|
308 |
image_data = Image.open(image.file)
|
309 |
image_data = image_data.convert("RGBA")
|
310 |
-
|
311 |
|
312 |
seed = 42
|
313 |
ss_guidance_strength = 7.5
|
@@ -341,9 +341,6 @@ async def generate_3d(image: UploadFile = File(...)):
|
|
341 |
raise HTTPException(status_code=500, detail=str(e))
|
342 |
|
343 |
|
344 |
-
@app.get("/test")
|
345 |
-
async def test_():
|
346 |
-
return JSONResponse(content={"TEST": "DONE!"})
|
347 |
@app.get("/")
|
348 |
async def root_():
|
349 |
return JSONResponse(content={"message": "HI!"})
|
|
|
299 |
|
300 |
app = FastAPI()
|
301 |
|
302 |
+
@app.post("/generate")
|
303 |
async def generate_3d(image: UploadFile = File(...)):
|
304 |
if not image:
|
305 |
raise HTTPException(status_code=400, detail="No image provided")
|
|
|
307 |
try:
|
308 |
image_data = Image.open(image.file)
|
309 |
image_data = image_data.convert("RGBA")
|
310 |
+
image_data = preprocess_image(image_data)
|
311 |
|
312 |
seed = 42
|
313 |
ss_guidance_strength = 7.5
|
|
|
341 |
raise HTTPException(status_code=500, detail=str(e))
|
342 |
|
343 |
|
|
|
|
|
|
|
344 |
@app.get("/")
|
345 |
async def root_():
|
346 |
return JSONResponse(content={"message": "HI!"})
|