Spaces:
Sleeping
Sleeping
Erva Ulusoy
commited on
Commit
·
41634be
1
Parent(s):
dcb3584
fixed numpy error added time calc for env setup
Browse files- ProtHGT_app.py +7 -5
- run_prothgt_app.py +1 -1
ProtHGT_app.py
CHANGED
|
@@ -1,18 +1,20 @@
|
|
| 1 |
import os
|
| 2 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
with st.spinner("Please wait while we prepare the environment. This may take a few minutes only on the first run..."):
|
| 5 |
# Run setup script if not already executed
|
| 6 |
if not os.path.exists(".setup_done"):
|
|
|
|
| 7 |
os.system("bash setup.sh")
|
|
|
|
|
|
|
| 8 |
with open(".setup_done", "w") as f:
|
| 9 |
f.write("done")
|
| 10 |
|
| 11 |
-
import streamlit.components.v1 as components
|
| 12 |
-
import os
|
| 13 |
-
import time
|
| 14 |
-
import pandas as pd
|
| 15 |
-
|
| 16 |
from run_prothgt_app import *
|
| 17 |
|
| 18 |
def convert_df(df):
|
|
|
|
| 1 |
import os
|
| 2 |
import streamlit as st
|
| 3 |
+
import time
|
| 4 |
+
import streamlit.components.v1 as components
|
| 5 |
+
import pandas as pd
|
| 6 |
+
|
| 7 |
|
| 8 |
with st.spinner("Please wait while we prepare the environment. This may take a few minutes only on the first run..."):
|
| 9 |
# Run setup script if not already executed
|
| 10 |
if not os.path.exists(".setup_done"):
|
| 11 |
+
start_time = time.time()
|
| 12 |
os.system("bash setup.sh")
|
| 13 |
+
end_time = time.time()
|
| 14 |
+
st.success(f"Environment prepared in {end_time - start_time:.2f} seconds")
|
| 15 |
with open(".setup_done", "w") as f:
|
| 16 |
f.write("done")
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
from run_prothgt_app import *
|
| 19 |
|
| 20 |
def convert_df(df):
|
run_prothgt_app.py
CHANGED
|
@@ -103,7 +103,7 @@ def _create_prediction_df(predictions, heterodata, protein_ids, go_category):
|
|
| 103 |
'Protein': protein_id,
|
| 104 |
'GO_category': go_category_dict[go_category],
|
| 105 |
'GO_term': list(heterodata[go_category]['id_mapping'].keys()),
|
| 106 |
-
'Probability': protein_predictions.
|
| 107 |
})
|
| 108 |
all_predictions.append(prediction_df)
|
| 109 |
|
|
|
|
| 103 |
'Protein': protein_id,
|
| 104 |
'GO_category': go_category_dict[go_category],
|
| 105 |
'GO_term': list(heterodata[go_category]['id_mapping'].keys()),
|
| 106 |
+
'Probability': protein_predictions.tolist()
|
| 107 |
})
|
| 108 |
all_predictions.append(prediction_df)
|
| 109 |
|