Spaces:
Runtime error
Runtime error
File size: 1,531 Bytes
d4a5429 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
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)
|