Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,22 +38,14 @@ def tryon_local(person_img, garment_img, seed, randomize_seed):
|
|
| 38 |
# -----------------------------
|
| 39 |
hunyuan_client = Client("tencent/Hunyuan3D-2.1")
|
| 40 |
|
| 41 |
-
# Auto-detect available API function
|
| 42 |
-
available_functions = hunyuan_client.get_functions()
|
| 43 |
-
if len(available_functions) == 0:
|
| 44 |
-
raise RuntimeError("No functions available in Hunyuan3D Space")
|
| 45 |
-
api_name = available_functions[0]["api_name"] # use first available function
|
| 46 |
-
|
| 47 |
def tryon_to_3d(person_img, garment_img, seed, randomize_seed):
|
| 48 |
tryon_img, seed_used, info = tryon_local(person_img, garment_img, seed, randomize_seed)
|
| 49 |
if tryon_img is None:
|
| 50 |
return None, "Try-on failed"
|
| 51 |
|
| 52 |
try:
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
api_name=api_name
|
| 56 |
-
)
|
| 57 |
return result_3d, info
|
| 58 |
except Exception as e:
|
| 59 |
return None, f"Hunyuan3D API error: {e}"
|
|
|
|
| 38 |
# -----------------------------
|
| 39 |
hunyuan_client = Client("tencent/Hunyuan3D-2.1")
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
def tryon_to_3d(person_img, garment_img, seed, randomize_seed):
|
| 42 |
tryon_img, seed_used, info = tryon_local(person_img, garment_img, seed, randomize_seed)
|
| 43 |
if tryon_img is None:
|
| 44 |
return None, "Try-on failed"
|
| 45 |
|
| 46 |
try:
|
| 47 |
+
# Direct predict call; do NOT specify api_name
|
| 48 |
+
result_3d = hunyuan_client.predict(tryon_img)
|
|
|
|
|
|
|
| 49 |
return result_3d, info
|
| 50 |
except Exception as e:
|
| 51 |
return None, f"Hunyuan3D API error: {e}"
|