Spaces:
Sleeping
Sleeping
arnikdehnavi
commited on
Commit
•
eb58938
1
Parent(s):
6162279
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import skfuzzy as fuzz
|
2 |
+
from skfuzzy import control as crt
|
3 |
+
import numpy as np
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import pandas as pd
|
6 |
+
import streamlit as st
|
7 |
+
import matplotlib
|
8 |
+
import matplotlib.image as mpimg
|
9 |
+
|
10 |
+
sDA=crt.Antecedent(np.arange(0,100.01,0.1),'sda')#50
|
11 |
+
Udi=crt.Antecedent(np.arange(0,100.1,0.1),'udi')#50
|
12 |
+
Ase=crt.Antecedent(np.arange(0,100.1,0.1),'ase')#kamtaraz10
|
13 |
+
sDgp=crt.Antecedent(np.arange(0,100.1,0.1),'sdgp')
|
14 |
+
emtiaz_l=crt.Consequent(np.arange(-4,24.01,0.01),'score')
|
15 |
+
|
16 |
+
sDA['low']=fuzz.trapmf(sDA.universe,[0,0,46.7,55])
|
17 |
+
sDA['acceptable']=fuzz.trapmf(sDA.universe,[46.7,55,75,86.25])
|
18 |
+
sDA['excelent']=fuzz.trapmf(sDA.universe,[75,86.25,100,100])
|
19 |
+
|
20 |
+
Udi['low']=fuzz.trapmf(Udi.universe,[0,0,42.5,50])
|
21 |
+
Udi['acceptable']=fuzz.trapmf(Udi.universe,[42.5,50,100,100])
|
22 |
+
|
23 |
+
Ase['acceptable']=fuzz.trapmf(Ase.universe,[0,0,10,11.5])
|
24 |
+
Ase['unacceptable']=fuzz.trapmf(Ase.universe,[10,11.5,100,100])
|
25 |
+
|
26 |
+
sDgp['acceptable']=fuzz.trapmf(sDgp.universe,[0,0,35,40.25])
|
27 |
+
sDgp['high']=fuzz.trapmf(sDgp.universe,[35,40.25,100,100])
|
28 |
+
|
29 |
+
emtiaz_l['awful']=fuzz.gaussmf(emtiaz_l.universe,0,1)
|
30 |
+
emtiaz_l['bad']=fuzz.gaussmf(emtiaz_l.universe,4,1)
|
31 |
+
emtiaz_l['not_bad']=fuzz.gaussmf(emtiaz_l.universe,8,1)
|
32 |
+
emtiaz_l['good']=fuzz.gaussmf(emtiaz_l.universe,12,1)
|
33 |
+
emtiaz_l['very_good']=fuzz.gaussmf(emtiaz_l.universe,16,1)
|
34 |
+
emtiaz_l['excelent']=fuzz.gaussmf(emtiaz_l.universe,20,1)
|
35 |
+
|
36 |
+
r1=crt.Rule(sDA['excelent']&Udi['acceptable']&Ase['acceptable']&sDgp['acceptable'],emtiaz_l['excelent'])
|
37 |
+
r2=crt.Rule(sDA['acceptable']&Udi['acceptable']&Ase['acceptable']&sDgp['acceptable'],emtiaz_l['very_good'])
|
38 |
+
|
39 |
+
r3=crt.Rule(sDA['excelent']&~Udi['acceptable']&Ase['acceptable']&sDgp['acceptable'],emtiaz_l['very_good'])
|
40 |
+
r4=crt.Rule(sDA['excelent']&Udi['acceptable']&~Ase['acceptable']&sDgp['acceptable'],emtiaz_l['very_good'])
|
41 |
+
r5=crt.Rule(sDA['excelent']&Udi['acceptable']&Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['very_good'])
|
42 |
+
|
43 |
+
|
44 |
+
r6=crt.Rule(sDA['acceptable']&~Udi['acceptable']&Ase['acceptable']&sDgp['acceptable'],emtiaz_l['good'])
|
45 |
+
r7=crt.Rule(sDA['acceptable']&Udi['acceptable']&~Ase['acceptable']&sDgp['acceptable'],emtiaz_l['good'])
|
46 |
+
r8=crt.Rule(sDA['acceptable']&Udi['acceptable']&Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['good'])
|
47 |
+
|
48 |
+
r9=crt.Rule(sDA['excelent']&~Udi['acceptable']&~Ase['acceptable']&sDgp['acceptable'],emtiaz_l['good'])
|
49 |
+
r10=crt.Rule(sDA['excelent']&~Udi['acceptable']&Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['good'])
|
50 |
+
r11=crt.Rule(sDA['excelent']&Udi['acceptable']&~Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['good'])
|
51 |
+
|
52 |
+
r12=crt.Rule(sDA['acceptable']&~Udi['acceptable']&~Ase['acceptable']&sDgp['acceptable'],emtiaz_l['not_bad'])
|
53 |
+
r13=crt.Rule(sDA['acceptable']&~Udi['acceptable']&Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['not_bad'])
|
54 |
+
r14=crt.Rule(sDA['acceptable']&Udi['acceptable']&~Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['not_bad'])
|
55 |
+
|
56 |
+
r15=crt.Rule(sDA['excelent']&~Udi['acceptable']&~Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['not_bad'])
|
57 |
+
|
58 |
+
|
59 |
+
r16=crt.Rule(sDA['low']&Udi['acceptable']&Ase['acceptable']&sDgp['acceptable'],emtiaz_l['very_good'])
|
60 |
+
r17=crt.Rule(sDA['low']&~Udi['acceptable']&Ase['acceptable']&sDgp['acceptable'],emtiaz_l['good'])
|
61 |
+
r18=crt.Rule(sDA['low']&Udi['acceptable']&~Ase['acceptable']&sDgp['acceptable'],emtiaz_l['good'])
|
62 |
+
r19=crt.Rule(sDA['low']&Udi['acceptable']&Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['good'])
|
63 |
+
|
64 |
+
r20=crt.Rule(sDA['low']&~Udi['acceptable']&~Ase['acceptable']&sDgp['acceptable'],emtiaz_l['bad'])
|
65 |
+
r21=crt.Rule(sDA['low']&Udi['acceptable']&~Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['bad'])
|
66 |
+
|
67 |
+
r22=crt.Rule(sDA['low']&~Udi['acceptable']&~Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['bad'])
|
68 |
+
r23=crt.Rule(sDA['acceptable']&~Udi['acceptable']&~Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['not_bad'])
|
69 |
+
r24=crt.Rule(sDA['acceptable']&Udi['acceptable']&~Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['not_bad'])
|
70 |
+
r25=crt.Rule(sDA['low']&~Udi['acceptable']&Ase['acceptable']&~sDgp['acceptable'],emtiaz_l['not_bad'])
|
71 |
+
|
72 |
+
|
73 |
+
cs=crt.ControlSystem([r1,
|
74 |
+
r2,
|
75 |
+
r3,
|
76 |
+
r4,
|
77 |
+
r5,
|
78 |
+
r6,
|
79 |
+
r7,
|
80 |
+
r8,
|
81 |
+
r9,
|
82 |
+
r10,
|
83 |
+
r11,
|
84 |
+
r12,
|
85 |
+
r13,
|
86 |
+
r14,
|
87 |
+
r15,
|
88 |
+
r16,
|
89 |
+
r17,
|
90 |
+
r18,
|
91 |
+
r19,
|
92 |
+
r20,
|
93 |
+
r21,
|
94 |
+
r22,
|
95 |
+
r23,
|
96 |
+
r24,
|
97 |
+
r25,
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
])
|
102 |
+
cs1=crt.ControlSystemSimulation(cs)
|
103 |
+
|
104 |
+
st.title("daylight analysis")
|
105 |
+
|
106 |
+
b1=cs1.input['sda']=st.sidebar.slider('sDA',min_value=0.0,max_value=100.0,step=1.0,value=50.0)
|
107 |
+
c1=cs1.input['udi']=st.sidebar.slider('UDI',min_value=0.0,max_value=100.0,step=1.0,value=50.0)
|
108 |
+
d1=cs1.input['ase']=st.sidebar.slider('ASE',min_value=0.0,max_value=100.0,step=1.0,value=50.0)
|
109 |
+
e1=cs1.input['sdgp']=st.sidebar.slider('sDGP',min_value=0.0,max_value=100.0,step=1.0,value=50.0)
|
110 |
+
|
111 |
+
st.set_option('deprecation.showPyplotGlobalUse', False)
|
112 |
+
cs1.compute()
|
113 |
+
score=cs1.output['score']
|
114 |
+
st.set_option('deprecation.showPyplotGlobalUse', False)
|
115 |
+
st.header('your score is :')
|
116 |
+
st.header(score)
|
117 |
+
|
118 |
+
st.header('sDA')
|
119 |
+
img = mpimg.imread('sda.jpg')
|
120 |
+
values=[]
|
121 |
+
imgplot = plt.imshow(img)
|
122 |
+
|
123 |
+
plt.yticks(values)
|
124 |
+
plt.xticks(values)
|
125 |
+
plt.scatter(b1*5655/100,1,s=500,marker="v",color='black')
|
126 |
+
st.pyplot()
|
127 |
+
|
128 |
+
st.header('UDI')
|
129 |
+
img = mpimg.imread('sda.jpg')
|
130 |
+
values=[]
|
131 |
+
imgplot = plt.imshow(img)
|
132 |
+
|
133 |
+
plt.yticks(values)
|
134 |
+
plt.xticks(values)
|
135 |
+
plt.scatter(c1*5655/100,1,s=500,marker="v",color='black')
|
136 |
+
st.pyplot()
|
137 |
+
|
138 |
+
|
139 |
+
|
140 |
+
|
141 |
+
st.header('ASE')
|
142 |
+
img = mpimg.imread('ASE.jpg')
|
143 |
+
values=[]
|
144 |
+
imgplot = plt.imshow(img)
|
145 |
+
|
146 |
+
plt.yticks(values)
|
147 |
+
plt.xticks(values)
|
148 |
+
plt.scatter(d1*5655/100,1,s=500,marker="v",color='black')
|
149 |
+
|
150 |
+
st.pyplot()
|
151 |
+
|
152 |
+
st.header('sDGP')
|
153 |
+
img = mpimg.imread('sdg1.jpg')
|
154 |
+
values=[]
|
155 |
+
imgplot = plt.imshow(img)
|
156 |
+
|
157 |
+
plt.yticks(values)
|
158 |
+
plt.xticks(values)
|
159 |
+
plt.scatter(e1*5655/100,1,s=500,marker="v",color='black')
|
160 |
+
|
161 |
+
st.pyplot()
|
162 |
+
|
163 |
+
|