anvilinteractiv commited on
Commit
6417969
·
verified ·
1 Parent(s): 92f8d79

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -485,7 +485,7 @@ def run_texture(image: Image, mesh_path: str, seed: int, req: gr.Request):
485
  logger.error(f"Error in run_texture: {str(e)}")
486
  raise
487
 
488
- @spaces.GPU(duration=5)
489
  @torch.no_grad()
490
  def run_full_api(image, seed: int = 0, num_inference_steps: int = 50, guidance_scale: float = 7.5, simplify: bool = True, target_face_num: int = DEFAULT_FACE_NUMBER, req: gr.Request = None):
491
  try:
@@ -509,9 +509,8 @@ def run_full_api(image, seed: int = 0, num_inference_steps: int = 50, guidance_s
509
  raise ValueError(f"Invalid image path: {image_path}")
510
 
511
  image_seg, mesh_path, textured_glb_path = run_full(image_path, seed, num_inference_steps, guidance_scale, simplify, target_face_num, req)
512
- session_hash = os.path.basename(os.path.dirname(textured_glb_path))
513
- logger.info(f"Generated textured model at /files/{session_hash}/{os.path.basename(textured_glb_path)}")
514
- return {"file_url": f"/files/{session_hash}/{os.path.basename(textured_glb_path)}", "seg_image": image_seg, "mesh_path": mesh_path, "textured_glb_path": textured_glb_path}
515
  except Exception as e:
516
  logger.error(f"Error in run_full_api: {str(e)}")
517
  raise
 
485
  logger.error(f"Error in run_texture: {str(e)}")
486
  raise
487
 
488
+ @spaces.GPU(duration=10)
489
  @torch.no_grad()
490
  def run_full_api(image, seed: int = 0, num_inference_steps: int = 50, guidance_scale: float = 7.5, simplify: bool = True, target_face_num: int = DEFAULT_FACE_NUMBER, req: gr.Request = None):
491
  try:
 
509
  raise ValueError(f"Invalid image path: {image_path}")
510
 
511
  image_seg, mesh_path, textured_glb_path = run_full(image_path, seed, num_inference_steps, guidance_scale, simplify, target_face_num, req)
512
+ logger.info(f"Generated textured model at /files/{os.path.basename(os.path.dirname(textured_glb_path))}/{os.path.basename(textured_glb_path)}")
513
+ return image_seg, mesh_path, textured_glb_path # Return tuple instead of dictionary
 
514
  except Exception as e:
515
  logger.error(f"Error in run_full_api: {str(e)}")
516
  raise