Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -31,6 +31,7 @@ def virtual_tryon(human_img_path, garment_img_path, garment_type, request: Reque
|
|
31 |
raise gr.Error("Please upload both a human image and a garment image.")
|
32 |
|
33 |
user_ip = request.headers.get('x-forwarded-for') if request else "unknown"
|
|
|
34 |
if user_ip == "unknown":
|
35 |
# This error is not shown to the user but helps in debugging
|
36 |
print("Warning: Could not determine user IP.")
|
@@ -38,7 +39,6 @@ def virtual_tryon(human_img_path, garment_img_path, garment_type, request: Reque
|
|
38 |
pass
|
39 |
else:
|
40 |
headers = {"Authorization": f"Bearer {ASTRIA_API_KEY}"}
|
41 |
-
tune_title = f"Gradio VTO {user_ip}"
|
42 |
|
43 |
# 2. Usage Quota Check
|
44 |
yield None, f"Step 1/4: Checking usage quota..."
|
@@ -79,7 +79,7 @@ def virtual_tryon(human_img_path, garment_img_path, garment_type, request: Reque
|
|
79 |
("tune[prompts_attributes][][input_image]", ("human.jpg", human_f.read(), "image/jpeg")),
|
80 |
]
|
81 |
data = {
|
82 |
-
"tune[title]": f"
|
83 |
"tune[name]": garment_type,
|
84 |
"tune[model_type]": "faceid",
|
85 |
"tune[base_tune_id]": "1504944", # This is the base model for Flux although no image generation is done in this case
|
@@ -166,7 +166,7 @@ garment_img_path = "path/to/your/garment.jpg"
|
|
166 |
garment_type = "shirt" # Can be "shirt", "pants", or "dress"
|
167 |
# To track usage, you can include a user identifier in the title
|
168 |
user_identifier = "user-ip-or-id"
|
169 |
-
tune_title = f"
|
170 |
|
171 |
headers = {"Authorization": f"Bearer {ASTRIA_API_KEY}"}
|
172 |
|
|
|
31 |
raise gr.Error("Please upload both a human image and a garment image.")
|
32 |
|
33 |
user_ip = request.headers.get('x-forwarded-for') if request else "unknown"
|
34 |
+
tune_title = f"Gradio VTO {user_ip}"
|
35 |
if user_ip == "unknown":
|
36 |
# This error is not shown to the user but helps in debugging
|
37 |
print("Warning: Could not determine user IP.")
|
|
|
39 |
pass
|
40 |
else:
|
41 |
headers = {"Authorization": f"Bearer {ASTRIA_API_KEY}"}
|
|
|
42 |
|
43 |
# 2. Usage Quota Check
|
44 |
yield None, f"Step 1/4: Checking usage quota..."
|
|
|
79 |
("tune[prompts_attributes][][input_image]", ("human.jpg", human_f.read(), "image/jpeg")),
|
80 |
]
|
81 |
data = {
|
82 |
+
"tune[title]": f"{tune_title} {int(time.time())}",
|
83 |
"tune[name]": garment_type,
|
84 |
"tune[model_type]": "faceid",
|
85 |
"tune[base_tune_id]": "1504944", # This is the base model for Flux although no image generation is done in this case
|
|
|
166 |
garment_type = "shirt" # Can be "shirt", "pants", or "dress"
|
167 |
# To track usage, you can include a user identifier in the title
|
168 |
user_identifier = "user-ip-or-id"
|
169 |
+
tune_title = f"Gradio VTO - {user_identifier} - {int(time.time())}"
|
170 |
|
171 |
headers = {"Authorization": f"Bearer {ASTRIA_API_KEY}"}
|
172 |
|