Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,25 +4,42 @@ import requests
|
|
4 |
import streamlit as st
|
5 |
|
6 |
"""
|
7 |
-
#
|
8 |
-
|
9 |
"""
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
15 |
|
16 |
-
|
17 |
-
## This **{'is cordana' if pred == 'cordana' else 'is pestalotiopsis' if pred == 'pestalotiopsis' else 'is sigatoka' if pred == 'sigatoka' else 'is healthy'}**.
|
18 |
-
### Prediction result: {pred}
|
19 |
-
### Probability of {pred}: {probs[key].item()*100: .2f}%
|
20 |
-
"""
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
col1, col2, col3 = st.columns(3)
|
28 |
|
@@ -33,6 +50,62 @@ with col2:
|
|
33 |
with col3:
|
34 |
st.image(img3, caption="Image 3", use_column_width=True)
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
path = "./"
|
38 |
learn_inf = load_learner(path + "demo_model.pkl")
|
|
|
4 |
import streamlit as st
|
5 |
|
6 |
"""
|
7 |
+
# 香蕉病害分類
|
8 |
+
|
9 |
"""
|
10 |
|
11 |
+
"""
|
12 |
+
## 健康香蕉葉示例
|
13 |
+
"""
|
14 |
+
img1 = Image.open('/home/user/app/healthy_1.jpg')
|
15 |
+
img2 = Image.open('/home/user/app/healthy_2.jpg')
|
16 |
+
img3 = Image.open('/home/user/app/healthy_3.jpg')
|
17 |
|
18 |
+
col1, col2, col3 = st.columns(3)
|
|
|
|
|
|
|
|
|
19 |
|
20 |
+
with col1:
|
21 |
+
st.image(img1, caption="Image 1", use_column_width=True)
|
22 |
+
with col2:
|
23 |
+
st.image(img2, caption="Image 2", use_column_width=True)
|
24 |
+
with col3:
|
25 |
+
st.image(img3, caption="Image 3", use_column_width=True)
|
26 |
+
|
27 |
+
"""
|
28 |
+
# 香蕉葉斑病(Black sigatoka;Black leaf streak)
|
29 |
+
病原菌學名:Mycosphaerella fijiensis (= M. fijiensis var. fijiensis )
|
30 |
|
31 |
+
目前仍被視為危害全球香蕉產區最嚴重之病害,對香蕉作物之生存威脅至鉅。此病不但直接危害蕉株葉片,影響蕉株健葉數,導致產期延後或減產。
|
32 |
+
亦可間接造成香蕉外銷船運期間,因採收株葉片數不足,引發蕉果果齡偏高過熟而黃化廢棄。最早於1963年被報導發生於斐濟,國內最早記載於1927年,但缺乏考證。
|
33 |
+
1960年代在國內蕉區大流行,曾造成相當嚴重之損失,惟自1978年賽洛瑪颱風,高屏蕉區被夷為平地後,舊蕉園葉斑病菌初期感染源密度明顯降低,
|
34 |
+
加上全面執行葉部病害防治作業後,葉斑病發生地區由屏東往高雄旗山主產區逐年減少,目前僅侷限於臺灣東半部台東關山以北至花蓮壽豐之間,在西半部僅零星發生於高雄美濃至台南楠西一帶。
|
35 |
+
|
36 |
+
病徵:初期病徵通常出現在第3或第4片葉背面,為紅棕色小條斑,大約5~10 ×0.1~1公厘,與葉脈平行,通常集中在葉片左側和葉尖部位。
|
37 |
+
之後條斑擴大變黑,同時亦出現在葉表面。至中期條斑擴大而呈橢圓形褐斑,周圍有黃色暈圈。至後期轉呈黑褐色或黑色病斑,而後病斑中間開始變灰色。受害葉片提早枯死。
|
38 |
+
|
39 |
+
"""
|
40 |
+
img1 = Image.open('/home/user/app/sigatoka_1.jpg')
|
41 |
+
img2 = Image.open('/home/user/app/sigatoka_2.jpg')
|
42 |
+
img3 = Image.open('/home/user/app/sigatoka_3.jpg')
|
43 |
|
44 |
col1, col2, col3 = st.columns(3)
|
45 |
|
|
|
50 |
with col3:
|
51 |
st.image(img3, caption="Image 3", use_column_width=True)
|
52 |
|
53 |
+
"""
|
54 |
+
# 圓星病(Cordana leaf spot)
|
55 |
+
病原菌學名:Cordana musae(Zimm.)Hohnel
|
56 |
+
|
57 |
+
分布極廣,但屬輕微葉部病害。當葉片弱化、老化、處逆境、營養不良、有傷口或受其他生物感染時,危害較明顯。
|
58 |
+
病斑大,橢圓形,呈同心圓,淡褐色或黃色。病斑中心為灰色、周圍繞有鮮黃色暈圈;
|
59 |
+
|
60 |
+
病斑有時會融合擴大,或在葉片邊緣銜接而使整個葉緣枯掉,本病通常只在老葉發生。
|
61 |
+
防治方法:葉部黑星病防治藥劑對本病皆有防治效果。
|
62 |
+
"""
|
63 |
+
img1 = Image.open('/home/user/app/cordana_1.jpg')
|
64 |
+
img2 = Image.open('/home/user/app/cordana_2.jpg')
|
65 |
+
img3 = Image.open('/home/user/app/cordana_3.jpg')
|
66 |
+
|
67 |
+
col1, col2, col3 = st.columns(3)
|
68 |
+
|
69 |
+
with col1:
|
70 |
+
st.image(img1, caption="Image 1", use_column_width=True)
|
71 |
+
with col2:
|
72 |
+
st.image(img2, caption="Image 2", use_column_width=True)
|
73 |
+
with col3:
|
74 |
+
st.image(img3, caption="Image 3", use_column_width=True)
|
75 |
+
|
76 |
+
"""
|
77 |
+
# 擬盤多毛胞屬真菌病害(Pestalotiopsis)
|
78 |
+
著名的植物病原體品種,主要分布於熱帶地區,可危害多種果樹,於貯後病害紀錄如檬果、番石榴、荔枝、酪梨等皆曾發現,也常引起水果的果腐病。
|
79 |
+
|
80 |
+
病徵:感染葉片則出現淡黃褐色病斑,表面散生黑色小點,此為分生孢子盤構造,常發生於破損葉片或生長勢較弱的植株;
|
81 |
+
受感染植株在新梢的修剪傷口附近可見病班,病斑表面黑色小點突起,為分生孢子盤內有分生孢子,可由表面頂點孔處釋出。
|
82 |
+
"""
|
83 |
+
|
84 |
+
img1 = Image.open('/home/user/app/pestalotiopsis_1.jpg')
|
85 |
+
img2 = Image.open('/home/user/app/pestalotiopsis_2.jpg')
|
86 |
+
img3 = Image.open('/home/user/app/pestalotiopsis_3.jpg')
|
87 |
+
|
88 |
+
col1, col2, col3 = st.columns(3)
|
89 |
+
|
90 |
+
with col1:
|
91 |
+
st.image(img1, caption="Image 1", use_column_width=True)
|
92 |
+
with col2:
|
93 |
+
st.image(img2, caption="Image 2", use_column_width=True)
|
94 |
+
with col3:
|
95 |
+
st.image(img3, caption="Image 3", use_column_width=True)
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
def predict(img):
|
100 |
+
st.image(img, caption="Your image", use_column_width=True)
|
101 |
+
pred, key, probs = learn_inf.predict(img)
|
102 |
+
# st.write(learn_inf.predict(img))
|
103 |
+
|
104 |
+
f"""
|
105 |
+
## This **{'is cordana' if pred == 'cordana' else 'is pestalotiopsis' if pred == 'pestalotiopsis' else 'is sigatoka' if pred == 'sigatoka' else 'is healthy'}** banana leaf.
|
106 |
+
### Prediction result: {pred}
|
107 |
+
### Probability of {pred}: {probs[key].item()*100: .2f}%
|
108 |
+
"""
|
109 |
|
110 |
path = "./"
|
111 |
learn_inf = load_learner(path + "demo_model.pkl")
|