KaraAgroAI
commited on
Commit
·
a11a419
1
Parent(s):
bdb3c06
Delete app.py
Browse files
app.py
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
# import gradio as gr
|
2 |
-
|
3 |
-
# gr.Interface.load("models/KaraAgroAI/CADI-AI").launch()
|
4 |
-
|
5 |
-
import gradio as gr
|
6 |
-
# import cv2
|
7 |
-
# import requests
|
8 |
-
# import os
|
9 |
-
from PIL import Image
|
10 |
-
import torch
|
11 |
-
import ultralytics
|
12 |
-
|
13 |
-
model = torch.hub.load("ultralytics/yolov5", "custom", path="yolov5_0.65map_exp7_best.pt",
|
14 |
-
force_reload=False)
|
15 |
-
|
16 |
-
model.conf = 0.20 # NMS confidence threshold
|
17 |
-
|
18 |
-
# sample test images
|
19 |
-
path = [['sample-images/27.jpg', 'sample-images/82.jpg', 'sample-images/91.jpg']]
|
20 |
-
|
21 |
-
def show_preds_image(im):
|
22 |
-
|
23 |
-
results = model(im) # inference
|
24 |
-
return results.render()[0]
|
25 |
-
|
26 |
-
inputs_image = [
|
27 |
-
gr.components.Image(type="filepath", label="Input Image"),
|
28 |
-
]
|
29 |
-
outputs_image = [
|
30 |
-
gr.components.Image(type="filepath", label="Output Image"),
|
31 |
-
]
|
32 |
-
interface_image = gr.Interface(
|
33 |
-
fn=show_preds_image,
|
34 |
-
inputs=inputs_image,
|
35 |
-
outputs=outputs_image,
|
36 |
-
title="Cashew Disease Identification with AI",
|
37 |
-
examples=path,
|
38 |
-
cache_examples=False,
|
39 |
-
)
|
40 |
-
|
41 |
-
interface_image.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|