Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -33,7 +33,7 @@ def classify_image(image, candidate_labels):
|
|
33 |
|
34 |
# Organize results
|
35 |
results = [
|
36 |
-
{"score": score, "label": candidate_label}
|
37 |
for score, candidate_label in sorted(zip(probs, candidate_labels), key=lambda x: -x[0])
|
38 |
]
|
39 |
|
@@ -76,7 +76,21 @@ iface = gr.Interface(
|
|
76 |
gr.Textbox(label="Messages")
|
77 |
],
|
78 |
title="General Action Classifier",
|
79 |
-
description="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
)
|
81 |
|
82 |
if __name__ == "__main__":
|
|
|
33 |
|
34 |
# Organize results
|
35 |
results = [
|
36 |
+
{"score": float(score), "label": candidate_label}
|
37 |
for score, candidate_label in sorted(zip(probs, candidate_labels), key=lambda x: -x[0])
|
38 |
]
|
39 |
|
|
|
76 |
gr.Textbox(label="Messages")
|
77 |
],
|
78 |
title="General Action Classifier",
|
79 |
+
description="""
|
80 |
+
**Instructions:**
|
81 |
+
|
82 |
+
1. **Upload an Image**: Drag and drop an image or click to upload an image file.
|
83 |
+
|
84 |
+
2. **Enter Candidate Labels**:
|
85 |
+
- Provide candidate labels separated by commas.
|
86 |
+
- For example: `human with beverage,human,beverage`
|
87 |
+
- The label "other" will automatically be added to the list of candidate labels.
|
88 |
+
|
89 |
+
3. **View Results**:
|
90 |
+
- The result will indicate whether the specified action (top label) is present in the image.
|
91 |
+
- Detailed scores for each label will be displayed in a table.
|
92 |
+
- Additional messages explaining the decision process will also be shown.
|
93 |
+
"""
|
94 |
)
|
95 |
|
96 |
if __name__ == "__main__":
|