Spaces:
Runtime error
Runtime error
arnikdehnavi
commited on
Commit
•
aadc56f
1
Parent(s):
7562fe6
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import skfuzzy as fuzz
|
2 |
from skfuzzy import control as crt
|
3 |
import numpy as np
|
@@ -6,6 +8,9 @@ import matplotlib as ml
|
|
6 |
import streamlit as st
|
7 |
import math
|
8 |
from mpl_toolkits.mplot3d import Axes3D
|
|
|
|
|
|
|
9 |
st.title('Schematic Design')
|
10 |
|
11 |
|
@@ -17,6 +22,8 @@ ertefa=crt.Antecedent(np.arange(2.3,10.001,0.001),'e')
|
|
17 |
WWR=crt.Antecedent(np.arange(0,1.001,0.001),'f')
|
18 |
emtiaz_HH=crt.Consequent(np.arange(-4,24.01,0.01),'score')
|
19 |
g1=st.sidebar.radio('climate',['hot and humid','hot and dry','cold','moderate and humid'])
|
|
|
|
|
20 |
jahat['low']=fuzz.trimf(jahat.universe,[0,5,12])
|
21 |
jahat['medium']=fuzz.trimf(jahat.universe,[5,12,17.5])
|
22 |
jahat['re_hight']=fuzz.trimf(jahat.universe,[12,17.5,25])
|
@@ -186,43 +193,62 @@ r52,
|
|
186 |
r53,r54,r55,r56,r57,r58,r59])
|
187 |
cs1=crt.ControlSystemSimulation(cs)
|
188 |
|
|
|
|
|
|
|
|
|
189 |
|
190 |
-
c1=cs1.input['c']=st.sidebar.slider("tanasobat",min_value=0.1,max_value=4.0,step=0.1,value=1.0)
|
191 |
a1=cs1.input['a']=st.sidebar.slider("jahat",min_value=0.00,max_value=40.00,step=0.1,value=0.0)
|
192 |
b1=cs1.input['b']=st.sidebar.slider("jerm_hararati",min_value=0.00,max_value=4180.00,step=0.1,value=0.0)
|
193 |
|
194 |
d1=cs1.input['d']=st.sidebar.slider("feshordegi",min_value=0.00,max_value=1.0,step=0.01,value=0.1)
|
195 |
e1=cs1.input['e']=st.sidebar.slider("ertefa",min_value=2.3,max_value=5.00,step=0.01,value=3.31)
|
196 |
-
|
197 |
-
|
|
|
198 |
cs1.compute()
|
199 |
g11=cs1.output['score']
|
|
|
200 |
|
201 |
# Create axis
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
#
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import plotly.graph_objects as go
|
3 |
import skfuzzy as fuzz
|
4 |
from skfuzzy import control as crt
|
5 |
import numpy as np
|
|
|
8 |
import streamlit as st
|
9 |
import math
|
10 |
from mpl_toolkits.mplot3d import Axes3D
|
11 |
+
import streamlit as st
|
12 |
+
|
13 |
+
|
14 |
st.title('Schematic Design')
|
15 |
|
16 |
|
|
|
22 |
WWR=crt.Antecedent(np.arange(0,1.001,0.001),'f')
|
23 |
emtiaz_HH=crt.Consequent(np.arange(-4,24.01,0.01),'score')
|
24 |
g1=st.sidebar.radio('climate',['hot and humid','hot and dry','cold','moderate and humid'])
|
25 |
+
|
26 |
+
|
27 |
jahat['low']=fuzz.trimf(jahat.universe,[0,5,12])
|
28 |
jahat['medium']=fuzz.trimf(jahat.universe,[5,12,17.5])
|
29 |
jahat['re_hight']=fuzz.trimf(jahat.universe,[12,17.5,25])
|
|
|
193 |
r53,r54,r55,r56,r57,r58,r59])
|
194 |
cs1=crt.ControlSystemSimulation(cs)
|
195 |
|
196 |
+
width=st.sidebar.slider("width",min_value=1,max_value=10,step=1,value=5)
|
197 |
+
length=st.sidebar.slider("length",min_value=1,max_value=10,step=1,value=8)
|
198 |
+
c1=cs1.input['c']=length/width
|
199 |
+
|
200 |
|
|
|
201 |
a1=cs1.input['a']=st.sidebar.slider("jahat",min_value=0.00,max_value=40.00,step=0.1,value=0.0)
|
202 |
b1=cs1.input['b']=st.sidebar.slider("jerm_hararati",min_value=0.00,max_value=4180.00,step=0.1,value=0.0)
|
203 |
|
204 |
d1=cs1.input['d']=st.sidebar.slider("feshordegi",min_value=0.00,max_value=1.0,step=0.01,value=0.1)
|
205 |
e1=cs1.input['e']=st.sidebar.slider("ertefa",min_value=2.3,max_value=5.00,step=0.01,value=3.31)
|
206 |
+
height=e1
|
207 |
+
f1=cs1.input['f']=st.sidebar.slider("wwr",min_value=0,max_value=100,step=5,value=50)
|
208 |
+
wwr= ((f1 - 1) / 99) * 50 + 50
|
209 |
cs1.compute()
|
210 |
g11=cs1.output['score']
|
211 |
+
g11=round(g11)
|
212 |
|
213 |
# Create axis
|
214 |
+
|
215 |
+
|
216 |
+
st.metric(label="your fuzzy score", value=g11)
|
217 |
+
#st.set_option('deprecation.showPyplotGlobalUse', False)
|
218 |
+
#st.pyplot()
|
219 |
+
|
220 |
+
|
221 |
+
|
222 |
+
# Create sliders to adjust the dimensions
|
223 |
+
|
224 |
+
|
225 |
+
|
226 |
+
# Use Plotly to create a 3D cube with the adjusted dimensions
|
227 |
+
fig = go.Figure(data=[
|
228 |
+
# Main body of the cube
|
229 |
+
go.Mesh3d(x=[0, width, width, 0, 0, width, width, 0],
|
230 |
+
y=[0, 0, length, length, 0, 0, length, length],
|
231 |
+
z=[0, 0, 0, 0, height, height, height, height],
|
232 |
+
alphahull=0,
|
233 |
+
color='#F5DEB3',
|
234 |
+
opacity=1,
|
235 |
+
lighting=dict(ambient=0.5, diffuse=0.9, roughness=0.1, specular=0.2, fresnel=0.2),
|
236 |
+
flatshading=True,
|
237 |
+
hoverinfo='none'),
|
238 |
+
# Window surface
|
239 |
+
go.Mesh3d(x=[width+0.05,width+0.05,width+0.05,width+0.05],
|
240 |
+
y=[length*(wwr/100), length*(wwr/100), length*(1-wwr/100), length*(1-wwr/100) ],
|
241 |
+
z=[height*(wwr/100), height*(1-wwr/100), height*(1-wwr/100), height*(wwr/100)],
|
242 |
+
i=[2, 3, 0, 1, 0, 3],
|
243 |
+
j=[1, 2, 3, 3, 2, 0],
|
244 |
+
k=[0, 1, 2, 0, 2, 3],
|
245 |
+
color='skyblue',
|
246 |
+
opacity=1,
|
247 |
+
lighting=dict(ambient=0.5, diffuse=0.9, roughness=0.1, specular=0.2, fresnel=0.2),
|
248 |
+
flatshading=True,
|
249 |
+
hoverinfo='none')]
|
250 |
+
)
|
251 |
+
fig.update_layout(scene=dict(zaxis=dict(visible=False,range=[0,5],autorange=False),xaxis=dict(visible=False,range=[0,10],autorange=False),yaxis=dict(visible=False,range=[0,10],autorange=False)),width=100,height=800)
|
252 |
+
|
253 |
+
# Use Streamlit to display the 3D c ube
|
254 |
+
st.plotly_chart(fig,use_container_width=True)
|