Spaces:
Runtime error
Runtime error
Update app.py
#6
by
kadirnar
- opened
- app.py +6 -3
- requirements.txt +0 -1
app.py
CHANGED
|
@@ -3,6 +3,9 @@ from PIL import Image
|
|
| 3 |
import gradio as gr
|
| 4 |
import numpy
|
| 5 |
import torch
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
model_id_list = ['deprem-ml/Binafarktespit-yolo5x-v1-xview', 'SerdarHelli/deprem_satellite_labeled_yolov8', 'kadirnar/yolov7-v0.1', 'kadirnar/UNet-EfficientNet-b6-Istanbul']
|
| 8 |
current_device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
@@ -87,7 +90,7 @@ def sahi_yolov5_inference(
|
|
| 87 |
|
| 88 |
model = YOLO('SerdarHelli/deprem_satellite_labeled_yolov8')
|
| 89 |
result = model.predict(image, imgsz=image_size)[0]
|
| 90 |
-
render = render_result(model=model, image=image, result=result
|
| 91 |
return render
|
| 92 |
|
| 93 |
elif model_type == "YOLOv7":
|
|
@@ -128,7 +131,7 @@ examples = [
|
|
| 128 |
["data/27.jpg", 'deprem-ml/Binafarktespit-yolo5x-v1-xview', "YOLOv5 + SAHI", 640, 512, 512, 0.1, 0.1, "NMS", "IOU", 0.25, False],
|
| 129 |
["data/28.jpg", 'deprem-ml/Binafarktespit-yolo5x-v1-xview', "YOLOv5 + SAHI", 640, 512, 512, 0.1, 0.1, "NMS", "IOU", 0.25, False],
|
| 130 |
["data/31.jpg", 'deprem-ml/SerdarHelli-yolov8-v1-xview', "YOLOv8", 640, 512, 512, 0.1, 0.1, "NMS", "IOU", 0.25, False],
|
| 131 |
-
["data/Istanbul.jpg", 'kadirnar/UNet-EfficientNet-b6-Istanbul', "Unet-Istanbul", 512, 512, 512, 0.1, 0.1, "NMS", "IOU", 0.25, False],
|
| 132 |
]
|
| 133 |
|
| 134 |
|
|
@@ -141,7 +144,7 @@ demo = gr.Interface(
|
|
| 141 |
article=article,
|
| 142 |
examples=examples,
|
| 143 |
theme="huggingface",
|
| 144 |
-
cache_examples=
|
| 145 |
)
|
| 146 |
|
| 147 |
demo.launch(debug=True, enable_queue=True)
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
import numpy
|
| 5 |
import torch
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
os.system('pip install git+https://github.com/fcakyon/ultralyticsplus.git')
|
| 9 |
|
| 10 |
model_id_list = ['deprem-ml/Binafarktespit-yolo5x-v1-xview', 'SerdarHelli/deprem_satellite_labeled_yolov8', 'kadirnar/yolov7-v0.1', 'kadirnar/UNet-EfficientNet-b6-Istanbul']
|
| 11 |
current_device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 90 |
|
| 91 |
model = YOLO('SerdarHelli/deprem_satellite_labeled_yolov8')
|
| 92 |
result = model.predict(image, imgsz=image_size)[0]
|
| 93 |
+
render = render_result(model=model, image=image, result=result)
|
| 94 |
return render
|
| 95 |
|
| 96 |
elif model_type == "YOLOv7":
|
|
|
|
| 131 |
["data/27.jpg", 'deprem-ml/Binafarktespit-yolo5x-v1-xview', "YOLOv5 + SAHI", 640, 512, 512, 0.1, 0.1, "NMS", "IOU", 0.25, False],
|
| 132 |
["data/28.jpg", 'deprem-ml/Binafarktespit-yolo5x-v1-xview', "YOLOv5 + SAHI", 640, 512, 512, 0.1, 0.1, "NMS", "IOU", 0.25, False],
|
| 133 |
["data/31.jpg", 'deprem-ml/SerdarHelli-yolov8-v1-xview', "YOLOv8", 640, 512, 512, 0.1, 0.1, "NMS", "IOU", 0.25, False],
|
| 134 |
+
#["data/Istanbul.jpg", 'kadirnar/UNet-EfficientNet-b6-Istanbul', "Unet-Istanbul", 512, 512, 512, 0.1, 0.1, "NMS", "IOU", 0.25, False],
|
| 135 |
]
|
| 136 |
|
| 137 |
|
|
|
|
| 144 |
article=article,
|
| 145 |
examples=examples,
|
| 146 |
theme="huggingface",
|
| 147 |
+
cache_examples=False,
|
| 148 |
)
|
| 149 |
|
| 150 |
demo.launch(debug=True, enable_queue=True)
|
requirements.txt
CHANGED
|
@@ -2,6 +2,5 @@ torch==1.7.1
|
|
| 2 |
yolov5==7.0.8
|
| 3 |
sahi==0.11.11
|
| 4 |
yolov7detect==1.0.1
|
| 5 |
-
ultralyticsplus==0.0.26
|
| 6 |
segmentation-models-pytorch==0.1.3
|
| 7 |
albumentations==1.3.0
|
|
|
|
| 2 |
yolov5==7.0.8
|
| 3 |
sahi==0.11.11
|
| 4 |
yolov7detect==1.0.1
|
|
|
|
| 5 |
segmentation-models-pytorch==0.1.3
|
| 6 |
albumentations==1.3.0
|