Spaces:
Sleeping
Sleeping
Fixed Indentation error
Browse files
app.py
CHANGED
|
@@ -85,20 +85,20 @@ def get_tryon_result(model_name, garment1, garment2, seed=1234):
|
|
| 85 |
|
| 86 |
|
| 87 |
try:
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
except KeyError:
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
headers = {
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
}
|
| 102 |
|
| 103 |
seed = random.randint(0, 1222222222)
|
| 104 |
data = {
|
|
|
|
| 85 |
|
| 86 |
|
| 87 |
try:
|
| 88 |
+
base_url = "https://www.outfitanyone.life/api/tryon"
|
| 89 |
+
api_key = os.environ.get("OA_IP_ADDRESS") # reads your key from Hugging Face secrets
|
| 90 |
+
except KeyError:
|
| 91 |
+
print("Error: OA_IP_ADDRESS environment variable not set!")
|
| 92 |
+
# return a dummy image instead of crashing
|
| 93 |
+
dummy_img = np.zeros((512, 512, 3), dtype=np.uint8)
|
| 94 |
+
dummy_img = cv2.putText(dummy_img, 'Error: API key not set', (50, 256),
|
| 95 |
+
cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2)
|
| 96 |
+
return add_waterprint(dummy_img)
|
| 97 |
+
|
| 98 |
+
headers = {
|
| 99 |
+
'Content-Type': 'application/json',
|
| 100 |
+
'Authorization': f'Bearer {ak_l0YMrBxXgd4KmyyychTYIhE3KgbxYJgGqLLpYrjzgvxeWxV2YAFNHuCCmAVJh}' # add your key here
|
| 101 |
+
}
|
| 102 |
|
| 103 |
seed = random.randint(0, 1222222222)
|
| 104 |
data = {
|