SyedSyab's picture
model added
d4a5429
raw
history blame
1.53 kB
import streamlit as st
import pandas as pd
import joblib
import time
# importing modules
import frontend.instructions as fi
fi.displayInstructionSection()
import frontend.selectingSeqType as sst
seqType = sst.selecType()
import frontend.gettingInput as gi
sequence = gi.gettingInput()
from backend.labelingInput import returnValues
from backend import labelingInput
from backend import gettingFromModel
#giveing data
selectingView = st.selectbox("Select View",["Table View","Simple View"])
modelPath = "backend/xgboost_model.joblib"
LabelETargetedPath = "backend/LabelETargeted.joblib"
LabelESequencePath = "backend/LabelESequence.joblib"
# button
predict = st.button('Predict')
if predict:
if sequence == "":
st.error('No sequence: Please Provide Sequence First')
else:
with st.spinner("getting values..."):
labelingInput.giveValues(sequence)
data = returnValues(len(sequence), sequence)
print(data.columns)
st.success("Generated...")
for key,values in data.items():
st.code(f"{key}: {values[0]}")
with st.spinner("Loading model..."):
model = joblib.load(modelPath)
LabelT = joblib.load(LabelETargetedPath)
LabelS = joblib.load(LabelESequencePath)
response = gettingFromModel.getResponse(data,model,LabelT,LabelS)
st.info(f'Predicted, it is "{response[0].upper()}"')
time.sleep(1)
st.bar_chart(data)