Spaces:
Build error
Build error
| import streamlit as st | |
| from collections import namedtuple as NamedTuple | |
| from math import floor | |
| import joblib | |
| central_gpu = joblib.load("centralGPU") | |
| central_ssd = joblib.load("centralSSD") | |
| gpu = NamedTuple("GPU_SPECS", ["transistors", | |
| "base_clock", | |
| "mem_clock", | |
| "mem_size", | |
| "shading_units", | |
| "TMUs", | |
| "ROPs", | |
| "mem_type_GDDR5", | |
| "mem_type_GDDR5X", | |
| "mem_type_GDDR6", | |
| "mem_type_GDDR6X", | |
| "mem_type_GDDR7"]) | |
| ssd = NamedTuple("SSD_SPECS", [ | |
| "seq_read_write", | |
| "endurance", | |
| "type_MLC", | |
| "type_QLC", | |
| "type_SLC", | |
| "type_TLC", | |
| "interface_PCIe_3_0_x4", | |
| "interface_PCIe_4_0_x4", | |
| "interface_PCIe_5_0_x4", | |
| "interface_SATA_6_Gbps", | |
| "protocol_AHCI", | |
| "protocol_NVMe", | |
| "protocol_NVMe_1_2", | |
| "protocol_NVMe_1_3", | |
| "protocol_NVMe_1_4", | |
| "protocol_NVMe_2_0" | |
| ]) | |
| st.write("<i>" | |
| "<center id=\"wtitle\" style=\"color: #dbd8e3; font-size:50px;\">welcome to <u>central</u> !</center>" | |
| "</i>", unsafe_allow_html=True) | |
| radio_buttons = st.radio("Select component : ", ("GPU", "SSD")) | |
| if radio_buttons == "GPU": | |
| transistors = st.text_input("the number of transistors in million") | |
| base_clock = st.text_input("the base clock in MHz") | |
| mem_clock = st.text_input("the memory clock in MHz") | |
| mem_size = st.text_input("the memory size") | |
| shading_units = st.text_input("the number of shading units") | |
| TMUs = st.text_input("the number of TMUs") | |
| ROPs = st.text_input("the number of ROPs") | |
| mem_type = st.radio("select the memory type", ("GDDR5", "GDDR5X", "GDDR6", "GDDR6X", "GDDR7")) | |
| predict = st.button("predict the price") | |
| if predict and transistors and base_clock and mem_clock and mem_size and shading_units and TMUs and ROPs and mem_type: | |
| try: | |
| GPU_SPECS = gpu( | |
| # memory and graphics related specs | |
| transistors=int(transistors), # million transistor | |
| base_clock=int(base_clock), # in MHz | |
| mem_clock=int(mem_clock), # in MHz | |
| mem_size=int(mem_size), # in GBs | |
| shading_units=int(shading_units), | |
| TMUs=int(TMUs), | |
| ROPs=int(ROPs), | |
| # memory type | |
| mem_type_GDDR5=mem_type == "GDDR5", | |
| mem_type_GDDR5X=mem_type == "GDDR5X", | |
| mem_type_GDDR6=mem_type == "GDDR6", | |
| mem_type_GDDR6X=mem_type == "GDDR6X", | |
| mem_type_GDDR7=mem_type == "GDDR7" | |
| ) | |
| st.write("> the predicted launch price for this GPU is : $%s"%(floor(*central_gpu.predict([*[GPU_SPECS]])))) | |
| except: | |
| st.write("some inputs are with wrong types") | |
| else: | |
| st.write("you need to fill all the inputs") | |
| elif radio_buttons == "SSD": | |
| seq_read = st.text_input("the sequential read in MB/s") | |
| seq_write = st.text_input("the sequential write in MB/s") | |
| endurance = st.text_input("the endurance in TBW") | |
| ssd_type = st.radio("give the SSD type", ("MLC", "QLC", "SLC", "TLC")) | |
| interface = st.radio("give the SSD interface", ("PCIe 3.0 x4", "PCIe 4.0 x4", "PCIe 5.0 x4", "SATA 6GBps")) | |
| protocol = st.radio("give the protocol : ", ("AHCI", "NVMe", "NVMe 1.2", "NVMe 1.3", "NVMe 1.4", "NVMe 2.0")) | |
| predict = st.button("predict the price") | |
| if predict and seq_read and seq_write and endurance and ssd_type and interface and protocol: | |
| try: | |
| SSD_SPECS = ssd( | |
| seq_read_write=int(seq_read) + int(seq_write), # in MB/s (sequential read + sequential write) | |
| endurance=int(endurance), # in TBW | |
| # SSD types | |
| type_MLC=ssd_type == "MLC", | |
| type_QLC=ssd_type == "QLC", | |
| type_SLC=ssd_type == "SLC", | |
| type_TLC=ssd_type == "TLC", | |
| # SSD interfaces | |
| interface_PCIe_3_0_x4=interface == "PCIe 3.0 x4", | |
| interface_PCIe_4_0_x4=interface == "PCIe 4.0 x4", | |
| interface_PCIe_5_0_x4=interface == "PCIe 5.0 x4", | |
| interface_SATA_6_Gbps=interface == "SATA 6GBps", | |
| # SSD protocols | |
| protocol_AHCI=protocol == "AHCI", | |
| protocol_NVMe=protocol == "NVMe", | |
| protocol_NVMe_1_2=protocol == "NVMe 1.2", | |
| protocol_NVMe_1_3=protocol == "NVMe 1.3", | |
| protocol_NVMe_1_4=protocol == "NVMe 1.4", | |
| protocol_NVMe_2_0=protocol == "NVMe 2.0" | |
| ) | |
| st.write("> the predicted launch price for this SSD is : $%s"%(floor(*central_ssd.predict([*[SSD_SPECS]])))) | |
| except: | |
| st.write("some inputs are with wrong types") | |
| else: | |
| st.write("you need to fill all the inputs") |