Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -148,6 +148,11 @@ def get_top_clip_clothing(probs, n=1):
|
|
| 148 |
|
| 149 |
# --- Core Logic ---
|
| 150 |
def analyze_outfit(input_img: Image.Image):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
if input_img is None:
|
| 152 |
return ("<p style='color: #FF5555; text-align: center;'>Please upload an image.</p>",
|
| 153 |
None, "Error: No image provided.")
|
|
|
|
| 148 |
|
| 149 |
# --- Core Logic ---
|
| 150 |
def analyze_outfit(input_img: Image.Image):
|
| 151 |
+
if isinstance(input_img, str): # If receiving filepath from API
|
| 152 |
+
input_img = Image.open(input_img)
|
| 153 |
+
|
| 154 |
+
if isinstance(input_img, np.ndarray): # If receiving numpy array
|
| 155 |
+
input_img = Image.fromarray(input_img.astype('uint8'))
|
| 156 |
if input_img is None:
|
| 157 |
return ("<p style='color: #FF5555; text-align: center;'>Please upload an image.</p>",
|
| 158 |
None, "Error: No image provided.")
|