Spaces:
Runtime error
Runtime error
S Santhosh Kumar
commited on
Commit
•
b46ce85
1
Parent(s):
0aa00fc
first commit
Browse files- app.py +44 -0
- logistic_regression_model.pkl +0 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import numpy as np
|
3 |
+
import pandas as pd
|
4 |
+
import joblib
|
5 |
+
import ast
|
6 |
+
|
7 |
+
st.set_page_config(page_title="App for predicting RNA-Sq prediction")
|
8 |
+
|
9 |
+
def load_lr_model():
|
10 |
+
return joblib.load('logistic_regression_model.pkl')
|
11 |
+
|
12 |
+
model = load_lr_model()
|
13 |
+
|
14 |
+
st.title('Model Serving Web App for predicting the Tumor in RNA sequence')
|
15 |
+
st.caption('Get RNA-sq Predictions From The Latest Model.')
|
16 |
+
|
17 |
+
# Create a horizontal line, and then a new container.
|
18 |
+
st.markdown("---")
|
19 |
+
|
20 |
+
with st.container():
|
21 |
+
|
22 |
+
uploaded_file = st.file_uploader("Upload RNA-sq txt file", type="txt")
|
23 |
+
|
24 |
+
if uploaded_file is not None:
|
25 |
+
rna_seq = uploaded_file.getvalue().decode("utf-8").splitlines()
|
26 |
+
|
27 |
+
trigger = st.button('Make Prediction')
|
28 |
+
|
29 |
+
if trigger:
|
30 |
+
st.info("Loading the data for predictions")
|
31 |
+
data = ast.literal_eval(rna_seq[0])
|
32 |
+
data = np.asarray(list(data)).reshape(1, -1)
|
33 |
+
predicted_labels = model.predict(data)
|
34 |
+
if int(predicted_labels[0]) == 1:
|
35 |
+
st.success("Tumor found in the RNA-Sq :thumbsup:")
|
36 |
+
else:
|
37 |
+
st.error('Tumor not found in the RNA-Sq :thumbsdown:')
|
38 |
+
|
39 |
+
# Add text about supported tissues for tumor prediction.
|
40 |
+
st.subheader("Supported Tissues for Tumor Prediction")
|
41 |
+
tissue_list = [
|
42 |
+
"Head/Neck", "Lung", "Kidney", "Colon", "Liver", "Breast", "Prostate"
|
43 |
+
]
|
44 |
+
st.write(", ".join(tissue_list) + ".")
|
logistic_regression_model.pkl
ADDED
Binary file (471 kB). View file
|
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
numpy
|
2 |
+
pandas
|
3 |
+
joblib
|