datasetter458 commited on
Commit
e81bbe8
·
verified ·
1 Parent(s): cc33197

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +117 -117
app.py CHANGED
@@ -1,118 +1,118 @@
1
- import streamlit as st
2
- from collections import namedtuple as NamedTuple
3
- from math import floor
4
- import joblib
5
- central_gpu = joblib.load("centralGPU")
6
- central_ssd = joblib.load("centralSSD")
7
-
8
- gpu = NamedTuple("GPU_SPECS", ["transistors",
9
- "base_clock",
10
- "mem_clock",
11
- "mem_size",
12
- "shading_units",
13
- "TMUs",
14
- "ROPs",
15
- "mem_type_GDDR5",
16
- "mem_type_GDDR5X",
17
- "mem_type_GDDR6",
18
- "mem_type_GDDR6X",
19
- "mem_type_GDDR7"])
20
- ssd = NamedTuple("SSD_SPECS", [
21
- "seq_read_write",
22
- "endurance",
23
- "type_MLC",
24
- "type_QLC",
25
- "type_SLC",
26
- "type_TLC",
27
- "interface_PCIe_3_0_x4",
28
- "interface_PCIe_4_0_x4",
29
- "interface_PCIe_5_0_x4",
30
- "interface_SATA_6_Gbps",
31
- "protocol_AHCI",
32
- "protocol_NVMe",
33
- "protocol_NVMe_1_2",
34
- "protocol_NVMe_1_3",
35
- "protocol_NVMe_1_4",
36
- "protocol_NVMe_2_0"
37
- ])
38
-
39
- st.write("<i>"
40
- "<center id=\"wtitle\" style=\"color: yellow; font-size:50px;\">welcome to central !</center>"
41
- "</i>", unsafe_allow_html=True)
42
- radio_buttons = st.radio("Select component : ", ("GPU", "SSD"))
43
-
44
- if radio_buttons == "GPU":
45
- transistors = st.text_input("the number of transistors in million")
46
- base_clock = st.text_input("the base clock in MHz")
47
- mem_clock = st.text_input("the memory clock in MHz")
48
- mem_size = st.text_input("the memory size")
49
- shading_units = st.text_input("the number of shading units")
50
- TMUs = st.text_input("the number of TMUs")
51
- ROPs = st.text_input("the number of ROPs")
52
- mem_type = st.radio("select the memory type", ("GDDR5", "GDDR5X", "GDDR6", "GDDR6X", "GDDR7"))
53
- predict = st.button("predict the price")
54
-
55
- if predict and transistors and base_clock and mem_clock and mem_size and shading_units and TMUs and ROPs and mem_type:
56
- try:
57
- GPU_SPECS = gpu(
58
- # memory and graphics related specs
59
- transistors=int(transistors), # million transistor
60
- base_clock=int(base_clock), # in MHz
61
- mem_clock=int(mem_clock), # in MHz
62
- mem_size=int(mem_size), # in GBs
63
- shading_units=int(shading_units),
64
- TMUs=int(TMUs),
65
- ROPs=int(ROPs),
66
-
67
- # memory type
68
- mem_type_GDDR5=mem_type == "GDDR5",
69
- mem_type_GDDR5X=mem_type == "GDDR5X",
70
- mem_type_GDDR6=mem_type == "GDDR6",
71
- mem_type_GDDR6X=mem_type == "GDDR6X",
72
- mem_type_GDDR7=mem_type == "GDDR7"
73
- )
74
- st.write("> the predicted launch price for this GPU is : $%s"%(floor(*central_gpu.predict([*[GPU_SPECS]]))))
75
- except:
76
- st.write("some inputs are with wrong types")
77
- else:
78
- st.write("you need to fill all the inputs")
79
-
80
- elif radio_buttons == "SSD":
81
- seq_read = st.text_input("the sequential read in MB/s")
82
- seq_write = st.text_input("the sequential write in MB/s")
83
- endurance = st.text_input("the endurance in TBW")
84
- type = st.radio("give the SSD type", ("MLC", "QLC", "SLC", "TLC"))
85
- interface = st.radio("give the SSD interface", ("PCIe 3.0 x4", "PCIe 4.0 x4", "PCIe 5.0 x4", "SATA 6GBps"))
86
- protocol = st.radio("give the protocol : ", ("AHCI", "NVMe", "NVMe 1.2", "NVMe 1.3", "NVMe 1.4", "NVMe 2.0"))
87
- predict = st.button("predict the price")
88
- if predict and seq_read and seq_write and endurance and type and interface and protocol:
89
- try:
90
- SSD_SPECS = ssd(
91
- seq_read_write=int(seq_read) + int(seq_write), # in MB/s (sequential read + sequential write)
92
- endurance=int(endurance), # in TBW
93
-
94
- # SSD types
95
- type_MLC=type == "MLC",
96
- type_QLC=type == "QLC",
97
- type_SLC=type == "SLC",
98
- type_TLC=type == "TLC",
99
-
100
- # SSD interfaces
101
- interface_PCIe_3_0_x4=interface == "PCIe 3.0 x4",
102
- interface_PCIe_4_0_x4=interface == "PCIe 4.0 x4",
103
- interface_PCIe_5_0_x4=interface == "PCIe 5.0 x4",
104
- interface_SATA_6_Gbps=interface == "SATA 6GBps",
105
-
106
- # SSD protocols
107
- protocol_AHCI=protocol == "AHCI",
108
- protocol_NVMe=protocol == "NVMe",
109
- protocol_NVMe_1_2=protocol == "NVMe 1.2",
110
- protocol_NVMe_1_3=protocol == "NVMe 1.3",
111
- protocol_NVMe_1_4=protocol == "NVMe 1.4",
112
- protocol_NVMe_2_0=protocol == "NVMe 2.0"
113
- )
114
- st.write("> the predicted launch price for this GPU is : $%s"%(floor(*central_ssd.predict([*[SSD_SPECS]]))))
115
- except:
116
- st.write("some inputs are with wrong types")
117
- else:
118
  st.write("you need to fill all the inputs")
 
1
+ import streamlit as st
2
+ from collections import namedtuple as NamedTuple
3
+ from math import floor
4
+ import joblib
5
+ central_gpu = joblib.load("centralGPU")
6
+ central_ssd = joblib.load("centralSSD")
7
+
8
+ gpu = NamedTuple("GPU_SPECS", ["transistors",
9
+ "base_clock",
10
+ "mem_clock",
11
+ "mem_size",
12
+ "shading_units",
13
+ "TMUs",
14
+ "ROPs",
15
+ "mem_type_GDDR5",
16
+ "mem_type_GDDR5X",
17
+ "mem_type_GDDR6",
18
+ "mem_type_GDDR6X",
19
+ "mem_type_GDDR7"])
20
+ ssd = NamedTuple("SSD_SPECS", [
21
+ "seq_read_write",
22
+ "endurance",
23
+ "type_MLC",
24
+ "type_QLC",
25
+ "type_SLC",
26
+ "type_TLC",
27
+ "interface_PCIe_3_0_x4",
28
+ "interface_PCIe_4_0_x4",
29
+ "interface_PCIe_5_0_x4",
30
+ "interface_SATA_6_Gbps",
31
+ "protocol_AHCI",
32
+ "protocol_NVMe",
33
+ "protocol_NVMe_1_2",
34
+ "protocol_NVMe_1_3",
35
+ "protocol_NVMe_1_4",
36
+ "protocol_NVMe_2_0"
37
+ ])
38
+
39
+ st.write("<i>"
40
+ "<center id=\"wtitle\" style=\"color: #dbd8e3; font-size:50px;\">welcome to central !</center>"
41
+ "</i>", unsafe_allow_html=True)
42
+ radio_buttons = st.radio("Select component : ", ("GPU", "SSD"))
43
+
44
+ if radio_buttons == "GPU":
45
+ transistors = st.text_input("the number of transistors in million")
46
+ base_clock = st.text_input("the base clock in MHz")
47
+ mem_clock = st.text_input("the memory clock in MHz")
48
+ mem_size = st.text_input("the memory size")
49
+ shading_units = st.text_input("the number of shading units")
50
+ TMUs = st.text_input("the number of TMUs")
51
+ ROPs = st.text_input("the number of ROPs")
52
+ mem_type = st.radio("select the memory type", ("GDDR5", "GDDR5X", "GDDR6", "GDDR6X", "GDDR7"))
53
+ predict = st.button("predict the price")
54
+
55
+ if predict and transistors and base_clock and mem_clock and mem_size and shading_units and TMUs and ROPs and mem_type:
56
+ try:
57
+ GPU_SPECS = gpu(
58
+ # memory and graphics related specs
59
+ transistors=int(transistors), # million transistor
60
+ base_clock=int(base_clock), # in MHz
61
+ mem_clock=int(mem_clock), # in MHz
62
+ mem_size=int(mem_size), # in GBs
63
+ shading_units=int(shading_units),
64
+ TMUs=int(TMUs),
65
+ ROPs=int(ROPs),
66
+
67
+ # memory type
68
+ mem_type_GDDR5=mem_type == "GDDR5",
69
+ mem_type_GDDR5X=mem_type == "GDDR5X",
70
+ mem_type_GDDR6=mem_type == "GDDR6",
71
+ mem_type_GDDR6X=mem_type == "GDDR6X",
72
+ mem_type_GDDR7=mem_type == "GDDR7"
73
+ )
74
+ st.write("> the predicted launch price for this GPU is : $%s"%(floor(*central_gpu.predict([*[GPU_SPECS]]))))
75
+ except:
76
+ st.write("some inputs are with wrong types")
77
+ else:
78
+ st.write("you need to fill all the inputs")
79
+
80
+ elif radio_buttons == "SSD":
81
+ seq_read = st.text_input("the sequential read in MB/s")
82
+ seq_write = st.text_input("the sequential write in MB/s")
83
+ endurance = st.text_input("the endurance in TBW")
84
+ type = st.radio("give the SSD type", ("MLC", "QLC", "SLC", "TLC"))
85
+ interface = st.radio("give the SSD interface", ("PCIe 3.0 x4", "PCIe 4.0 x4", "PCIe 5.0 x4", "SATA 6GBps"))
86
+ protocol = st.radio("give the protocol : ", ("AHCI", "NVMe", "NVMe 1.2", "NVMe 1.3", "NVMe 1.4", "NVMe 2.0"))
87
+ predict = st.button("predict the price")
88
+ if predict and seq_read and seq_write and endurance and type and interface and protocol:
89
+ try:
90
+ SSD_SPECS = ssd(
91
+ seq_read_write=int(seq_read) + int(seq_write), # in MB/s (sequential read + sequential write)
92
+ endurance=int(endurance), # in TBW
93
+
94
+ # SSD types
95
+ type_MLC=type == "MLC",
96
+ type_QLC=type == "QLC",
97
+ type_SLC=type == "SLC",
98
+ type_TLC=type == "TLC",
99
+
100
+ # SSD interfaces
101
+ interface_PCIe_3_0_x4=interface == "PCIe 3.0 x4",
102
+ interface_PCIe_4_0_x4=interface == "PCIe 4.0 x4",
103
+ interface_PCIe_5_0_x4=interface == "PCIe 5.0 x4",
104
+ interface_SATA_6_Gbps=interface == "SATA 6GBps",
105
+
106
+ # SSD protocols
107
+ protocol_AHCI=protocol == "AHCI",
108
+ protocol_NVMe=protocol == "NVMe",
109
+ protocol_NVMe_1_2=protocol == "NVMe 1.2",
110
+ protocol_NVMe_1_3=protocol == "NVMe 1.3",
111
+ protocol_NVMe_1_4=protocol == "NVMe 1.4",
112
+ protocol_NVMe_2_0=protocol == "NVMe 2.0"
113
+ )
114
+ st.write("> the predicted launch price for this SSD is : $%s"%(floor(*central_ssd.predict([*[SSD_SPECS]]))))
115
+ except:
116
+ st.write("some inputs are with wrong types")
117
+ else:
118
  st.write("you need to fill all the inputs")