Spaces:
Runtime error
Runtime error
Upload 12 files
Browse files- .gitattributes +1 -0
- app.py +50 -19
- image/anthracnose.JPG +3 -0
- image/bacterial.JPG +0 -0
- image/ccyv.jpg +0 -0
- image/cornespora.JPG +0 -0
- image/downy.JPG +0 -0
- image/graymold.JPG +0 -0
- image/gummy.JPG +0 -0
- image/healthy.jpg +0 -0
- image/mosaic.jpg +0 -0
- image/mysv.jpg +0 -0
- image/powdery.JPG +0 -0
.gitattributes
CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
35 |
+
image/anthracnose.JPG filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -21,13 +21,18 @@ def main():
|
|
21 |
class_name = ["健全","うどんこ病","灰色かび病","炭疽病","べと病","褐斑病","つる枯病","斑点細菌病","CCYV","モザイク病","MYSV"]
|
22 |
|
23 |
# example
|
24 |
-
example=[
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
# model定義
|
33 |
model_ft = resnet18(num_classes = len(class_name),pretrained=False)
|
@@ -59,22 +64,48 @@ def main():
|
|
59 |
return {class_name[i]: float(probs[i]) for i in range(labels_lenght)}
|
60 |
|
61 |
|
62 |
-
# 入力の形式を画像とする
|
63 |
-
inputs = gr.inputs.Image()
|
64 |
|
65 |
-
# 出力はラベル形式で,top5まで表示する
|
66 |
-
outputs = gr.outputs.Label(num_top_classes=5)
|
67 |
|
68 |
-
# サーバーの立ち上げ
|
69 |
-
interface = gr.Interface(fn=inference,
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
|
|
|
|
78 |
|
79 |
if __name__ == "__main__":
|
80 |
main()
|
|
|
21 |
class_name = ["健全","うどんこ病","灰色かび病","炭疽病","べと病","褐斑病","つる枯病","斑点細菌病","CCYV","モザイク病","MYSV"]
|
22 |
|
23 |
# example
|
24 |
+
# example = [
|
25 |
+
# 'image/healthy.jpg',
|
26 |
+
# 'image/powdery.JPG',
|
27 |
+
# 'image/graymold.JPG',
|
28 |
+
# 'image/anthracnose.JPG',
|
29 |
+
# 'image/downy.JPG',
|
30 |
+
# 'image/cornespora.JPG',
|
31 |
+
# 'image/gummy.JPG',
|
32 |
+
# 'image/bacterial.JPG',
|
33 |
+
# 'image/ccyv.jpg',
|
34 |
+
# 'image/mosaic.jpg',
|
35 |
+
# 'image/mysv.jpg']
|
36 |
|
37 |
# model定義
|
38 |
model_ft = resnet18(num_classes = len(class_name),pretrained=False)
|
|
|
64 |
return {class_name[i]: float(probs[i]) for i in range(labels_lenght)}
|
65 |
|
66 |
|
67 |
+
# # 入力の形式を画像とする
|
68 |
+
# inputs = gr.inputs.Image()
|
69 |
|
70 |
+
# # 出力はラベル形式で,top5まで表示する
|
71 |
+
# outputs = gr.outputs.Label(num_top_classes=5)
|
72 |
|
73 |
+
# # サーバーの立ち上げ
|
74 |
+
# interface = gr.Interface(fn=inference,
|
75 |
+
# inputs=[inputs],
|
76 |
+
# outputs=outputs,
|
77 |
+
# examples=example,
|
78 |
+
# title=title,
|
79 |
+
# description=description)
|
80 |
+
|
81 |
+
with gr.Blocks(title="Cucumber Diseases Diagnosis",
|
82 |
+
css=".gradio-container {background:mintcream;}"
|
83 |
+
) as demo:
|
84 |
+
gr.HTML("""<div style="font-family:'Arial', 'Serif'; font-size:18pt; text-align:center; color:black;">Cucumber Diseases Diagnosis</div>""")
|
85 |
+
|
86 |
+
with gr.Row():
|
87 |
+
input_image = gr.inputs.Image()
|
88 |
+
output_label= gr.outputs.Label(num_top_classes=4)
|
89 |
+
|
90 |
+
send_btn = gr.Button("識別")
|
91 |
+
send_btn.click(fn=inference, inputs=input_image, outputs=output_label)
|
92 |
|
93 |
+
with gr.Row():
|
94 |
+
# gr.Examples(['image/healthy.jpg'], label='cucumber', inputs=input_image)
|
95 |
+
gr.Examples(['image/healthy.jpg'], label='健全', inputs=input_image)
|
96 |
+
gr.Examples(['image/powdery.JPG'], label='うどんこ病', inputs=input_image)
|
97 |
+
gr.Examples(['image/graymold.JPG'], label='灰色かび病', inputs=input_image)
|
98 |
+
gr.Examples(['image/anthracnose.JPG'], label='炭疽病', inputs=input_image)
|
99 |
+
gr.Examples(['image/downy.JPG'], label='べと病', inputs=input_image)
|
100 |
+
gr.Examples(['image/cornespora.JPG'], label='褐斑病', inputs=input_image)
|
101 |
+
gr.Examples(['image/gummy.JPG'], label='つる枯病', inputs=input_image)
|
102 |
+
gr.Examples(['image/bacterial.JPG'], label='斑点細菌病', inputs=input_image)
|
103 |
+
gr.Examples(['image/ccyv.jpg'], label='CCYV', inputs=input_image)
|
104 |
+
gr.Examples(['image/mosaic.jpg'], label='モザイク病', inputs=input_image)
|
105 |
+
gr.Examples(['image/mysv.jpg'], label='MYSV', inputs=input_image)
|
106 |
|
107 |
+
demo.launch()
|
108 |
+
|
109 |
|
110 |
if __name__ == "__main__":
|
111 |
main()
|
image/anthracnose.JPG
ADDED
Git LFS Details
|
image/bacterial.JPG
ADDED
image/ccyv.jpg
ADDED
image/cornespora.JPG
ADDED
image/downy.JPG
ADDED
image/graymold.JPG
ADDED
image/gummy.JPG
ADDED
image/healthy.jpg
ADDED
image/mosaic.jpg
ADDED
image/mysv.jpg
ADDED
image/powdery.JPG
ADDED