Spaces:
Running
Running
Tagmir Gilyazov
commited on
Commit
·
3dd80c3
1
Parent(s):
febbd43
upd
Browse files- app.py +0 -33
- requirments.txt → requirements.txt +0 -0
app.py
CHANGED
@@ -271,41 +271,8 @@ import time
|
|
271 |
|
272 |
od_pipe = pipeline("object-detection", "facebook/detr-resnet-50")
|
273 |
|
274 |
-
"""### tests"""
|
275 |
-
|
276 |
-
def test_model_on_image(model, image_path):
|
277 |
-
raw_image = Image.open(image_path)
|
278 |
-
start_time = time.time()
|
279 |
-
pipeline_output = model(raw_image)
|
280 |
-
end_time = time.time()
|
281 |
-
return {"elapsed_time": end_time - start_time, "raw_image": raw_image, "result": pipeline_output}
|
282 |
-
|
283 |
-
process_result = test_model_on_image(od_pipe, "sample.jpeg")
|
284 |
-
|
285 |
-
process_result
|
286 |
-
|
287 |
-
processed_image = render_results_in_image(
|
288 |
-
process_result["raw_image"],
|
289 |
-
process_result["result"])
|
290 |
-
|
291 |
-
processed_image
|
292 |
-
|
293 |
-
"""## chosen_model ("hustvl/yolos-small"). 123MB"""
|
294 |
-
|
295 |
chosen_model = pipeline("object-detection", "hustvl/yolos-small")
|
296 |
|
297 |
-
"""### tests"""
|
298 |
-
|
299 |
-
process_result2 = test_model_on_image(chosen_model, "sample.jpeg")
|
300 |
-
|
301 |
-
process_result2["result"]
|
302 |
-
|
303 |
-
processed_image2 = render_results_in_image(
|
304 |
-
process_result2["raw_image"],
|
305 |
-
process_result2["result"])
|
306 |
-
|
307 |
-
processed_image2
|
308 |
-
|
309 |
"""## gradio funcs"""
|
310 |
|
311 |
def get_object_detection_prediction(model_name, raw_image):
|
|
|
271 |
|
272 |
od_pipe = pipeline("object-detection", "facebook/detr-resnet-50")
|
273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
chosen_model = pipeline("object-detection", "hustvl/yolos-small")
|
275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
"""## gradio funcs"""
|
277 |
|
278 |
def get_object_detection_prediction(model_name, raw_image):
|
requirments.txt → requirements.txt
RENAMED
File without changes
|