Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ def process_cal(production,f_t):
|
|
8 |
steam = 6
|
9 |
enthalpy = 494
|
10 |
hot_drain = 0
|
11 |
-
cold_drain = 0
|
12 |
heat_water = water*1*(final_temp-intial_temp)
|
13 |
heat_fabric = production*0.4*(final_temp-intial_temp)
|
14 |
heat_radition = 10*10*(final_temp-30)*step_time/60
|
@@ -21,7 +21,8 @@ def process_cal(production,f_t):
|
|
21 |
cold_drain = water
|
22 |
|
23 |
return steam_consumption , cold_drain , hot_drain , water
|
24 |
-
|
|
|
25 |
total_water = 0
|
26 |
steam_consumption = 0
|
27 |
hot_drain = 0
|
@@ -38,9 +39,16 @@ def dark_shade(production):
|
|
38 |
cold_drain = int(cold_drain)
|
39 |
hot_drain = int(hot_drain)
|
40 |
total_water = cold_drain + hot_drain
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
#print(steam,cold,hot,water)
|
42 |
-
return steam_consumption , cold_drain , hot_drain , total_water
|
43 |
-
|
|
|
44 |
total_water = 0
|
45 |
steam_consumption = 0
|
46 |
hot_drain = 0
|
@@ -57,9 +65,16 @@ def medium_shade(production):
|
|
57 |
cold_drain = int(cold_drain)
|
58 |
hot_drain = int(hot_drain)
|
59 |
total_water = cold_drain + hot_drain
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
#print(steam,cold,hot,water)
|
61 |
-
return steam_consumption , cold_drain , hot_drain , total_water
|
62 |
-
|
|
|
63 |
total_water = 0
|
64 |
steam_consumption = 0
|
65 |
hot_drain = 0
|
@@ -76,9 +91,16 @@ def white_shade(production):
|
|
76 |
cold_drain = int(cold_drain)
|
77 |
hot_drain = int(hot_drain)
|
78 |
total_water = cold_drain + hot_drain
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
#print(steam,cold,hot,water)
|
80 |
-
return steam_consumption , cold_drain , hot_drain , total_water
|
81 |
-
|
|
|
82 |
total_water = 0
|
83 |
steam_consumption = 0
|
84 |
hot_drain = 0
|
@@ -95,44 +117,51 @@ def light_shade(production):
|
|
95 |
cold_drain = int(cold_drain)
|
96 |
hot_drain = int(hot_drain)
|
97 |
total_water = cold_drain + hot_drain
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
#print(steam,cold,hot,water)
|
99 |
-
return steam_consumption , cold_drain , hot_drain , total_water
|
|
|
100 |
def jigger(value1, value2, value3, value4):
|
101 |
-
s1,c1,h1,t1 =
|
102 |
-
s2,c2,h2,t2 =
|
103 |
-
s3,c3,h3,t3 =
|
104 |
-
s4,c4,h4,t4 =
|
105 |
final_steam = s1+s2+s3+s4
|
106 |
final_cold_drain = c1+c2+c3+c4
|
107 |
final_hot_drain = h1+h2+h3+h4
|
108 |
final_total_drain = t1+t2+t3+t4
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
iface = gr.Interface(
|
117 |
fn=jigger,
|
118 |
-
inputs=[
|
119 |
gr.Number(value=0, label="Dark"),
|
120 |
gr.Number(value=0, label="Medium"),
|
121 |
gr.Number(value=0, label="Light"),
|
122 |
gr.Number(value=0, label="White"),
|
123 |
],
|
124 |
-
outputs=
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
gr.Textbox(label="White"),
|
129 |
-
gr.Textbox(label="Total")
|
130 |
-
],
|
131 |
-
title="Steam Consumption, Water, Hot_Drain, Cold_Drain Calculation Dashboard for Jigger",
|
132 |
-
description="Enter values and click 'Calculate' to see the results.<br/><br/>"
|
133 |
-
+ "<sup>***</sup> Result will be in order Steam Consumption,Cold Drain, Hot Drain, Total Water.",
|
134 |
-
css=".gr-box {padding: 20px;}"
|
135 |
-
)
|
136 |
|
137 |
-
# Launch the interface
|
138 |
iface.launch()
|
|
|
8 |
steam = 6
|
9 |
enthalpy = 494
|
10 |
hot_drain = 0
|
11 |
+
cold_drain = 0
|
12 |
heat_water = water*1*(final_temp-intial_temp)
|
13 |
heat_fabric = production*0.4*(final_temp-intial_temp)
|
14 |
heat_radition = 10*10*(final_temp-30)*step_time/60
|
|
|
21 |
cold_drain = water
|
22 |
|
23 |
return steam_consumption , cold_drain , hot_drain , water
|
24 |
+
|
25 |
+
def dark_shade_jet(production):
|
26 |
total_water = 0
|
27 |
steam_consumption = 0
|
28 |
hot_drain = 0
|
|
|
39 |
cold_drain = int(cold_drain)
|
40 |
hot_drain = int(hot_drain)
|
41 |
total_water = cold_drain + hot_drain
|
42 |
+
if production != 0:
|
43 |
+
ssc1 = round(steam_consumption/production,2)
|
44 |
+
swc1 = round(total_water/production,2)
|
45 |
+
else:
|
46 |
+
ssc1 = 0
|
47 |
+
swc1 = 0
|
48 |
#print(steam,cold,hot,water)
|
49 |
+
return steam_consumption , cold_drain , hot_drain , total_water, ssc1,swc1
|
50 |
+
|
51 |
+
def medium_shade_jet(production):
|
52 |
total_water = 0
|
53 |
steam_consumption = 0
|
54 |
hot_drain = 0
|
|
|
65 |
cold_drain = int(cold_drain)
|
66 |
hot_drain = int(hot_drain)
|
67 |
total_water = cold_drain + hot_drain
|
68 |
+
if production != 0:
|
69 |
+
ssc2 = round(steam_consumption/production,2)
|
70 |
+
swc2 = round(total_water/production,2)
|
71 |
+
else:
|
72 |
+
ssc2 = 0
|
73 |
+
swc2 = 0
|
74 |
#print(steam,cold,hot,water)
|
75 |
+
return steam_consumption , cold_drain , hot_drain , total_water , ssc2,swc2
|
76 |
+
|
77 |
+
def white_shade_jet(production):
|
78 |
total_water = 0
|
79 |
steam_consumption = 0
|
80 |
hot_drain = 0
|
|
|
91 |
cold_drain = int(cold_drain)
|
92 |
hot_drain = int(hot_drain)
|
93 |
total_water = cold_drain + hot_drain
|
94 |
+
if production != 0:
|
95 |
+
ssc3 = round(steam_consumption/production,2)
|
96 |
+
swc3 = round(total_water/production,2)
|
97 |
+
else:
|
98 |
+
ssc3 = 0
|
99 |
+
swc3 = 0
|
100 |
#print(steam,cold,hot,water)
|
101 |
+
return steam_consumption , cold_drain , hot_drain , total_water , ssc3,swc3
|
102 |
+
|
103 |
+
def light_shade_jet(production):
|
104 |
total_water = 0
|
105 |
steam_consumption = 0
|
106 |
hot_drain = 0
|
|
|
117 |
cold_drain = int(cold_drain)
|
118 |
hot_drain = int(hot_drain)
|
119 |
total_water = cold_drain + hot_drain
|
120 |
+
if production != 0:
|
121 |
+
ssc4 = round(steam_consumption/production,2)
|
122 |
+
swc4 = round(total_water/production,2)
|
123 |
+
else:
|
124 |
+
ssc4 = 0
|
125 |
+
swc4 = 0
|
126 |
#print(steam,cold,hot,water)
|
127 |
+
return steam_consumption , cold_drain , hot_drain , total_water,ssc4,swc4
|
128 |
+
|
129 |
def jigger(value1, value2, value3, value4):
|
130 |
+
s1,c1,h1,t1,ssc1,swc1 = dark_shade_jet(value1)
|
131 |
+
s2,c2,h2,t2,ssc2,swc2 = medium_shade_jet(value2)
|
132 |
+
s3,c3,h3,t3,ssc3,swc3 = white_shade_jet(value3)
|
133 |
+
s4,c4,h4,t4,ssc4,swc4 = light_shade_jet(value4)
|
134 |
final_steam = s1+s2+s3+s4
|
135 |
final_cold_drain = c1+c2+c3+c4
|
136 |
final_hot_drain = h1+h2+h3+h4
|
137 |
final_total_drain = t1+t2+t3+t4
|
138 |
+
total_production = value1 + value2 + value3 + value4
|
139 |
+
ssc_final = round(final_steam/total_production,2)
|
140 |
+
swc_final = round(final_total_drain/total_production,2)
|
141 |
+
table_html = f"""
|
142 |
+
<table>
|
143 |
+
<tr><th>Shade</th><th>Steam Consumption</th><th>Cold Drain</th><th>Hot Drain</th><th>Total Water</th><th>SSC</th><th>SWC</th></tr>
|
144 |
+
<tr><th>Dark</th><td>{s1}</td><td>{c1}</td><td>{h1}</td><td>{t1}</td><td>{ssc1}</td><td>{swc1}</td></tr>
|
145 |
+
<tr><th>Medium</th><td>{s2}</td><td>{c2}</td><td>{h2}</td><td>{t2}</td><td>{ssc2}</td><td>{swc2}</td></tr>
|
146 |
+
<tr><th>Light</th><td>{s3}</td><td>{c3}</td><td>{h3}</td><td>{t3}</td><td>{ssc3}</td><td>{swc3}</td></tr>
|
147 |
+
<tr><th>White</th><td>{s4}</td><td>{c4}</td><td>{h4}</td><td>{t4}</td><td>{ssc4}</td><td>{swc4}</td></tr>
|
148 |
+
<tr><th>Total</th><td>{final_steam}</td><td>{final_cold_drain}</td><td>{final_hot_drain}</td><td>{final_total_drain}</td><td>{ssc_final}</td><td>{swc_final}</td></tr>
|
149 |
+
|
150 |
+
</table>
|
151 |
+
"""
|
152 |
+
return table_html
|
153 |
+
|
154 |
iface = gr.Interface(
|
155 |
fn=jigger,
|
156 |
+
inputs= [
|
157 |
gr.Number(value=0, label="Dark"),
|
158 |
gr.Number(value=0, label="Medium"),
|
159 |
gr.Number(value=0, label="Light"),
|
160 |
gr.Number(value=0, label="White"),
|
161 |
],
|
162 |
+
outputs= gr.components.HTML(label="Final Table"),
|
163 |
+
title ="Steam Consumption, Water, Hot_Drain, Cold_Drain Calculation Dashboard for Jigger",
|
164 |
+
description="Enter values and click 'Calculate' to see the results.<br/><br/>" ,
|
165 |
+
css=".gr-box {padding: 20px;}" )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
|
|
167 |
iface.launch()
|