dzmu commited on
Commit
ade8c4e
·
verified ·
1 Parent(s): ee9bd01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -153,16 +153,11 @@ def get_top_clip_clothing(probs, n=1):
153
  #None, "Error: No image provided.")
154
 
155
  #img = input_img.convert("RGB").copy() # Ensure image is in RGB
156
- def analyze_outfit(image_path: str):
157
- if not image_path or not os.path.exists(image_path):
158
- return (
159
- "<p style='color: #FF5555; text-align: center;'>Please upload an image.</p>",
160
- None,
161
- "Error: No image provided."
162
- )
163
-
164
- img = Image.open(image_path).convert("RGB").copy()
165
- print(f"[DEBUG] image_path type: {type(image_path)} | value: {image_path}")
166
 
167
  # 1) YOLO Person Detection
168
  person_results = yolo_person_model(img, verbose=False, conf=YOLO_PERSON_CONF_THRESHOLD)
@@ -536,7 +531,7 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
536
  with gr.Row():
537
  with gr.Column(scale=1):
538
  input_image = gr.Image(
539
- type="filepath",
540
  #type='pil',
541
  label="Upload Your Fit",
542
  sources=['upload', 'webcam', 'clipboard'],
 
153
  #None, "Error: No image provided.")
154
 
155
  #img = input_img.convert("RGB").copy() # Ensure image is in RGB
156
+ def analyze_outfit(image):
157
+ if image is None:
158
+ return ("<p style='color: #FF5555; text-align: center;'>Please upload an image.</p>", None, "Error: No image provided.")
159
+ image = image.convert("RGB").copy()
160
+ #print(f"[DEBUG] image_path type: {type(image_path)} | value: {image_path}")
 
 
 
 
 
161
 
162
  # 1) YOLO Person Detection
163
  person_results = yolo_person_model(img, verbose=False, conf=YOLO_PERSON_CONF_THRESHOLD)
 
531
  with gr.Row():
532
  with gr.Column(scale=1):
533
  input_image = gr.Image(
534
+ type="pil",
535
  #type='pil',
536
  label="Upload Your Fit",
537
  sources=['upload', 'webcam', 'clipboard'],