Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -40,10 +40,10 @@ def process_image(image):
|
|
40 |
clothing_text_features /= clothing_text_features.norm(dim=-1, keepdim=True)
|
41 |
|
42 |
# Calculate probabilities
|
43 |
-
type_text_probs = (100.0 * image_features @ type_text_features.T).
|
44 |
-
scene_text_probs = (100.0 * image_features @ scene_text_features.T).
|
45 |
-
expression_text_probs = (100.0 * image_features @ expression_text_features.T).
|
46 |
-
clothing_text_probs = (100.0 * image_features @ clothing_text_features.T).
|
47 |
|
48 |
# Convert to dictionaries
|
49 |
type_results = {label: float(type_text_probs[0][i]) for i, label in enumerate(type_labels)}
|
|
|
40 |
clothing_text_features /= clothing_text_features.norm(dim=-1, keepdim=True)
|
41 |
|
42 |
# Calculate probabilities
|
43 |
+
type_text_probs = (100.0 * image_features @ type_text_features.T).sigmoid(dim=-1)
|
44 |
+
scene_text_probs = (100.0 * image_features @ scene_text_features.T).sigmoid(dim=-1)
|
45 |
+
expression_text_probs = (100.0 * image_features @ expression_text_features.T).sigmoid(dim=-1)
|
46 |
+
clothing_text_probs = (100.0 * image_features @ clothing_text_features.T).sigmoid(dim=-1)
|
47 |
|
48 |
# Convert to dictionaries
|
49 |
type_results = {label: float(type_text_probs[0][i]) for i, label in enumerate(type_labels)}
|