Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,8 @@ from ultralytics import YOLO
|
|
| 7 |
|
| 8 |
file_urls = ["https://www.kp-glas.de/wp-content/uploads/2023/02/Bierflaschen.jpeg",
|
| 9 |
"https://www.bevindustry.com/ext/resources/issues/2020/February/Heineken-0-0-Alcohol-Free-Beer.jpg?1581450636",
|
| 10 |
-
"https://spice-world.co.za/cdn/shop/products/3520_648ad722263c64.28810246_drinks_20copy_1db265d5-e818-45d3-973b-3e046a6b0931_800x.jpg?v=1697124785"
|
|
|
|
| 11 |
|
| 12 |
def download_file(url, save_name):
|
| 13 |
if not os.path.exists(save_name):
|
|
@@ -15,10 +16,7 @@ def download_file(url, save_name):
|
|
| 15 |
open(save_name, 'wb').write(file.content)
|
| 16 |
|
| 17 |
for i, url in enumerate(file_urls):
|
| 18 |
-
|
| 19 |
-
download_file(file_urls[i], f"video.mp4")
|
| 20 |
-
else:
|
| 21 |
-
download_file(file_urls[i], f"image_{i}.jpg")
|
| 22 |
|
| 23 |
# Available model options
|
| 24 |
model_paths = [
|
|
@@ -27,7 +25,7 @@ model_paths = [
|
|
| 27 |
]
|
| 28 |
|
| 29 |
# Paths to example images
|
| 30 |
-
path = [['image_0.jpg'], ['image_1.jpg'], ['image_2.jpg']]
|
| 31 |
|
| 32 |
# Function to run inference and show predictions
|
| 33 |
def show_preds_image(image_path, selected_model):
|
|
|
|
| 7 |
|
| 8 |
file_urls = ["https://www.kp-glas.de/wp-content/uploads/2023/02/Bierflaschen.jpeg",
|
| 9 |
"https://www.bevindustry.com/ext/resources/issues/2020/February/Heineken-0-0-Alcohol-Free-Beer.jpg?1581450636",
|
| 10 |
+
"https://spice-world.co.za/cdn/shop/products/3520_648ad722263c64.28810246_drinks_20copy_1db265d5-e818-45d3-973b-3e046a6b0931_800x.jpg?v=1697124785",
|
| 11 |
+
"https://i.redd.it/0e2zml4mwz021.jpg"]
|
| 12 |
|
| 13 |
def download_file(url, save_name):
|
| 14 |
if not os.path.exists(save_name):
|
|
|
|
| 16 |
open(save_name, 'wb').write(file.content)
|
| 17 |
|
| 18 |
for i, url in enumerate(file_urls):
|
| 19 |
+
download_file(file_urls[i], f"image_{i}.jpg")
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# Available model options
|
| 22 |
model_paths = [
|
|
|
|
| 25 |
]
|
| 26 |
|
| 27 |
# Paths to example images
|
| 28 |
+
path = [['image_0.jpg'], ['image_1.jpg'], ['image_2.jpg'], ['image_3.jpg']]
|
| 29 |
|
| 30 |
# Function to run inference and show predictions
|
| 31 |
def show_preds_image(image_path, selected_model):
|