Spaces:
Runtime error
Runtime error
Shawn Shen
commited on
Commit
·
7714123
1
Parent(s):
3c6a079
functional v1
Browse files- Predictor.py +4 -3
- app.py +10 -6
Predictor.py
CHANGED
|
@@ -253,8 +253,8 @@ def predict_file(input_file):
|
|
| 253 |
|
| 254 |
print('====Predict====')
|
| 255 |
pred = eval_step(dataloader, model)
|
| 256 |
-
|
| 257 |
-
print(pred)
|
| 258 |
# print('====Save Results====')
|
| 259 |
# if not os.path.exists(args.outdir): os.makedirs(args.outdir)
|
| 260 |
# pred.to_csv(f'{args.outdir}/{args.outfilename}_prediction_results.csv', index = False)
|
|
@@ -272,4 +272,5 @@ def predict_raw(raw_input):
|
|
| 272 |
print('====Predict====')
|
| 273 |
pred = eval_step(dataloader, model)
|
| 274 |
|
| 275 |
-
print(pred)
|
|
|
|
|
|
| 253 |
|
| 254 |
print('====Predict====')
|
| 255 |
pred = eval_step(dataloader, model)
|
| 256 |
+
return pred
|
| 257 |
+
# print(pred)
|
| 258 |
# print('====Save Results====')
|
| 259 |
# if not os.path.exists(args.outdir): os.makedirs(args.outdir)
|
| 260 |
# pred.to_csv(f'{args.outdir}/{args.outfilename}_prediction_results.csv', index = False)
|
|
|
|
| 272 |
print('====Predict====')
|
| 273 |
pred = eval_step(dataloader, model)
|
| 274 |
|
| 275 |
+
# print(pred)
|
| 276 |
+
return pred
|
app.py
CHANGED
|
@@ -1,22 +1,26 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from Bio import SeqIO
|
| 3 |
from Predictor import predict_file, predict_raw
|
|
|
|
| 4 |
|
| 5 |
st.title("5' UTR prediction")
|
| 6 |
|
| 7 |
st.subheader("Input sequence")
|
| 8 |
#x = st.slider('Select a value')
|
| 9 |
# seq = ""
|
| 10 |
-
seq = st.
|
| 11 |
st.subheader("Upload sequence file")
|
| 12 |
uploaded = st.file_uploader("Sequence file in FASTA format")
|
| 13 |
# if uploaded:
|
|
|
|
|
|
|
|
|
|
| 14 |
# predict_file(uploaded)
|
| 15 |
# seq = SeqIO.read(uploaded, "fasta").seq
|
| 16 |
-
st.subheader("Prediction result:")
|
| 17 |
if st.button("Predict"):
|
|
|
|
| 18 |
if uploaded:
|
| 19 |
-
|
| 20 |
else:
|
| 21 |
-
predict_raw(seq)
|
| 22 |
-
# st.write("Sequence length = ", len(seq))
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
# from Bio import SeqIO
|
| 3 |
from Predictor import predict_file, predict_raw
|
| 4 |
+
from io import StringIO
|
| 5 |
|
| 6 |
st.title("5' UTR prediction")
|
| 7 |
|
| 8 |
st.subheader("Input sequence")
|
| 9 |
#x = st.slider('Select a value')
|
| 10 |
# seq = ""
|
| 11 |
+
seq = st.text_area("Input your sequence here", value="")
|
| 12 |
st.subheader("Upload sequence file")
|
| 13 |
uploaded = st.file_uploader("Sequence file in FASTA format")
|
| 14 |
# if uploaded:
|
| 15 |
+
# st.write(StringIO(uploaded.getvalue().decode("utf-8")))
|
| 16 |
+
# seq = uploaded.read()
|
| 17 |
+
# print(seq)
|
| 18 |
# predict_file(uploaded)
|
| 19 |
# seq = SeqIO.read(uploaded, "fasta").seq
|
| 20 |
+
# st.subheader("Prediction result:")
|
| 21 |
if st.button("Predict"):
|
| 22 |
+
st.write("Prediction result:")
|
| 23 |
if uploaded:
|
| 24 |
+
st.write(predict_raw(uploaded.getvalue().decode()))
|
| 25 |
else:
|
| 26 |
+
st.write(predict_raw(seq))
|
|
|