celery22 commited on
Commit
0d5bf9d
1 Parent(s): f232657

Upload 12 files

Browse files
.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
- ['image/231305_20200302150233_01.JPG'],
26
- ['image/0004_20181120084837_01.jpg'],
27
- ['image/160001_20170830173740_01.JPG'],
28
- ['image/152300_20190119175054_01.JPG'],
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
- inputs=[inputs],
71
- outputs=outputs,
72
- examples=example,
73
- title=title,
74
- description=description)
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
- interface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
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

  • SHA256: c97b43aa452101bd54703df940c2e0e467981cfe0fbb7692f45b51fbdd2edbe3
  • Pointer size: 132 Bytes
  • Size of remote file: 2.53 MB
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