Update app.py
Browse files
app.py
CHANGED
|
@@ -73,8 +73,10 @@ def detect_objects(model_name,url_input,image_input,webcam_input,threshold):
|
|
| 73 |
#Extract model and feature extractor
|
| 74 |
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
| 78 |
|
| 79 |
if validators.url(url_input):
|
| 80 |
image = get_original_image(url_input)
|
|
@@ -111,7 +113,8 @@ Links to HuggingFace Models:
|
|
| 111 |
- [hustlv/yolos-small](https://huggingface.co/hustlv/yolos-small)
|
| 112 |
"""
|
| 113 |
|
| 114 |
-
models = ["nickmuchi/yolos-small-rego-plates-detection","nickmuchi/yolos-small-license-plate-detection","nickmuchi/yolos-small-finetuned-license-plate-detection"
|
|
|
|
| 115 |
urls = ["https://drive.google.com/uc?id=1j9VZQ4NDS4gsubFf3m2qQoTMWLk552bQ","https://drive.google.com/uc?id=1p9wJIqRz3W50e2f_A0D8ftla8hoXz4T5"]
|
| 116 |
images = [[path.as_posix()] for path in sorted(pathlib.Path('images').rglob('*.j*g'))]
|
| 117 |
|
|
|
|
| 73 |
#Extract model and feature extractor
|
| 74 |
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
|
| 75 |
|
| 76 |
+
if "yolos" in model_name:
|
| 77 |
+
model = YolosForObjectDetection.from_pretrained(model_name)
|
| 78 |
+
elif "detr" in model_name:
|
| 79 |
+
model = DetrForObjectDetection.from_pretrained(model_name)
|
| 80 |
|
| 81 |
if validators.url(url_input):
|
| 82 |
image = get_original_image(url_input)
|
|
|
|
| 113 |
- [hustlv/yolos-small](https://huggingface.co/hustlv/yolos-small)
|
| 114 |
"""
|
| 115 |
|
| 116 |
+
models = ["nickmuchi/yolos-small-rego-plates-detection","nickmuchi/yolos-small-license-plate-detection","nickmuchi/yolos-small-finetuned-license-plate-detection",\
|
| 117 |
+
"nickmuchi/detr-resnet50-finetuned-license-plate-detection"]
|
| 118 |
urls = ["https://drive.google.com/uc?id=1j9VZQ4NDS4gsubFf3m2qQoTMWLk552bQ","https://drive.google.com/uc?id=1p9wJIqRz3W50e2f_A0D8ftla8hoXz4T5"]
|
| 119 |
images = [[path.as_posix()] for path in sorted(pathlib.Path('images').rglob('*.j*g'))]
|
| 120 |
|