Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -197,7 +197,7 @@ transform_image = transforms.Compose(
|
|
| 197 |
remove_bg_fn = lambda x: remove_bg(x, birefnet, transform_image, DEVICE)
|
| 198 |
|
| 199 |
if not os.path.exists("checkpoints/RealESRGAN_x2plus.pth"):
|
| 200 |
-
hf_hub_download("dtarnow/UPscaler", filename="
|
| 201 |
if not os.path.exists("checkpoints/big-lama.pt"):
|
| 202 |
subprocess.run("wget -P checkpoints/ https://github.com/Sanster/models/releases/download/add_big_lama/big-lama.pt", shell=True, check=True)
|
| 203 |
|
|
@@ -447,7 +447,7 @@ def run_texture(image: Image, mesh_path: str, seed: int, req: gr.Request):
|
|
| 447 |
from texture import TexturePipeline, ModProcessConfig
|
| 448 |
texture_pipe = TexturePipeline(
|
| 449 |
upscaler_ckpt_path="checkpoints/RealESRGAN_x2plus.pth",
|
| 450 |
-
|
| 451 |
device=DEVICE,
|
| 452 |
)
|
| 453 |
|
|
@@ -465,7 +465,6 @@ def run_texture(image: Image, mesh_path: str, seed: int, req: gr.Request):
|
|
| 465 |
return textured_glb_path
|
| 466 |
|
| 467 |
# FastAPI endpoint for generating 3D models
|
| 468 |
-
@spaces.GPU(duration=180)
|
| 469 |
@app.post("/api/generate")
|
| 470 |
async def generate_3d_model(request: GenerateRequest, image: UploadFile = File(...), api_key: str = Depends(verify_api_key)):
|
| 471 |
try:
|
|
|
|
| 197 |
remove_bg_fn = lambda x: remove_bg(x, birefnet, transform_image, DEVICE)
|
| 198 |
|
| 199 |
if not os.path.exists("checkpoints/RealESRGAN_x2plus.pth"):
|
| 200 |
+
hf_hub_download("dtarnow/UPscaler", filename="Real FeatherESRGAN_x2plus.pth", local_dir="checkpoints")
|
| 201 |
if not os.path.exists("checkpoints/big-lama.pt"):
|
| 202 |
subprocess.run("wget -P checkpoints/ https://github.com/Sanster/models/releases/download/add_big_lama/big-lama.pt", shell=True, check=True)
|
| 203 |
|
|
|
|
| 447 |
from texture import TexturePipeline, ModProcessConfig
|
| 448 |
texture_pipe = TexturePipeline(
|
| 449 |
upscaler_ckpt_path="checkpoints/RealESRGAN_x2plus.pth",
|
| 450 |
+
inpaint_ckpt_path="checkpoints/big-lama.pt",
|
| 451 |
device=DEVICE,
|
| 452 |
)
|
| 453 |
|
|
|
|
| 465 |
return textured_glb_path
|
| 466 |
|
| 467 |
# FastAPI endpoint for generating 3D models
|
|
|
|
| 468 |
@app.post("/api/generate")
|
| 469 |
async def generate_3d_model(request: GenerateRequest, image: UploadFile = File(...), api_key: str = Depends(verify_api_key)):
|
| 470 |
try:
|