Update app.py
Browse files
app.py
CHANGED
|
@@ -248,7 +248,7 @@ label_mapping = [
|
|
| 248 |
MODEL_NAME = "valentinafeve/yolos-fashionpedia"
|
| 249 |
|
| 250 |
feature_extractor = YolosImageProcessor.from_pretrained('hustvl/yolos-small')
|
| 251 |
-
model = YolosForObjectDetection.from_pretrained(MODEL_NAME)
|
| 252 |
|
| 253 |
def get_category_index(category):
|
| 254 |
# Find index of label mapping
|
|
@@ -380,7 +380,7 @@ def get_objects(image, threshold=0.8):
|
|
| 380 |
image = image.resize((600, 800))
|
| 381 |
|
| 382 |
inputs = feature_extractor(images=image, return_tensors="pt")
|
| 383 |
-
outputs = model(**inputs
|
| 384 |
|
| 385 |
detected_classes, output_img, crops, crop_classes = visualize_predictions(image, outputs, threshold=threshold)
|
| 386 |
for cl in detected_classes:
|
|
|
|
| 248 |
MODEL_NAME = "valentinafeve/yolos-fashionpedia"
|
| 249 |
|
| 250 |
feature_extractor = YolosImageProcessor.from_pretrained('hustvl/yolos-small')
|
| 251 |
+
model = YolosForObjectDetection.from_pretrained(MODEL_NAME)
|
| 252 |
|
| 253 |
def get_category_index(category):
|
| 254 |
# Find index of label mapping
|
|
|
|
| 380 |
image = image.resize((600, 800))
|
| 381 |
|
| 382 |
inputs = feature_extractor(images=image, return_tensors="pt")
|
| 383 |
+
outputs = model(**inputs)
|
| 384 |
|
| 385 |
detected_classes, output_img, crops, crop_classes = visualize_predictions(image, outputs, threshold=threshold)
|
| 386 |
for cl in detected_classes:
|