Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Andrew Stirn
commited on
Commit
·
0c6f011
1
Parent(s):
806fad9
cleanup
Browse files
app.py
CHANGED
|
@@ -51,7 +51,7 @@ def initiate_run():
|
|
| 51 |
transcripts = pd.DataFrame({
|
| 52 |
tiger.ID_COL: ['ManualEntry'],
|
| 53 |
tiger.SEQ_COL: [st.session_state.manual_entry]
|
| 54 |
-
})
|
| 55 |
|
| 56 |
# fasta file upload
|
| 57 |
elif st.session_state.entry_method == ENTRY_METHODS['fasta']:
|
|
@@ -78,7 +78,6 @@ def initiate_run():
|
|
| 78 |
|
| 79 |
# run model if we have any transcripts
|
| 80 |
elif len(transcripts) > 0:
|
| 81 |
-
st.session_state.running = True
|
| 82 |
st.session_state.transcripts = transcripts
|
| 83 |
|
| 84 |
|
|
@@ -90,8 +89,6 @@ if __name__ == '__main__':
|
|
| 90 |
st.session_state.disable_off_target_checkbox = True
|
| 91 |
if 'entry_method' not in st.session_state:
|
| 92 |
st.session_state.entry_method = ENTRY_METHODS['manual']
|
| 93 |
-
if 'running' not in st.session_state:
|
| 94 |
-
st.session_state.running = False
|
| 95 |
if 'transcripts' not in st.session_state:
|
| 96 |
st.session_state.transcripts = None
|
| 97 |
if 'input_error' not in st.session_state:
|
|
@@ -114,13 +111,13 @@ if __name__ == '__main__':
|
|
| 114 |
options=tuple(tiger.RUN_MODES.values()),
|
| 115 |
key='mode',
|
| 116 |
on_change=mode_change_callback,
|
| 117 |
-
disabled=st.session_state.
|
| 118 |
)
|
| 119 |
with col2:
|
| 120 |
st.checkbox(
|
| 121 |
label='Find off-target effects (slow)',
|
| 122 |
key='check_off_targets',
|
| 123 |
-
disabled=st.session_state.disable_off_target_checkbox or st.session_state.
|
| 124 |
)
|
| 125 |
|
| 126 |
# transcript entry
|
|
@@ -129,25 +126,25 @@ if __name__ == '__main__':
|
|
| 129 |
label='How would you like to provide transcript(s) of interest?',
|
| 130 |
options=ENTRY_METHODS.values(),
|
| 131 |
key='entry_method',
|
| 132 |
-
disabled=st.session_state.
|
| 133 |
)
|
| 134 |
if st.session_state.entry_method == ENTRY_METHODS['manual']:
|
| 135 |
st.text_input(
|
| 136 |
label='Enter a target transcript:',
|
| 137 |
key='manual_entry',
|
| 138 |
placeholder='Upper or lower case',
|
| 139 |
-
disabled=st.session_state.
|
| 140 |
)
|
| 141 |
elif st.session_state.entry_method == ENTRY_METHODS['fasta']:
|
| 142 |
st.file_uploader(
|
| 143 |
label='Upload a fasta file:',
|
| 144 |
key='fasta_entry',
|
| 145 |
-
disabled=st.session_state.
|
| 146 |
)
|
| 147 |
|
| 148 |
# runtime
|
| 149 |
with RUNTIME:
|
| 150 |
-
st.button(label='Get predictions!', on_click=initiate_run, disabled=st.session_state.
|
| 151 |
progress = st.empty()
|
| 152 |
|
| 153 |
# results
|
|
@@ -188,6 +185,5 @@ if __name__ == '__main__':
|
|
| 188 |
check_off_targets=st.session_state.check_off_targets,
|
| 189 |
status_update_fn=progress_update
|
| 190 |
)
|
| 191 |
-
st.session_state.running = False
|
| 192 |
st.session_state.transcripts = None
|
| 193 |
st.experimental_rerun()
|
|
|
|
| 51 |
transcripts = pd.DataFrame({
|
| 52 |
tiger.ID_COL: ['ManualEntry'],
|
| 53 |
tiger.SEQ_COL: [st.session_state.manual_entry]
|
| 54 |
+
}).set_index(tiger.ID_COL)
|
| 55 |
|
| 56 |
# fasta file upload
|
| 57 |
elif st.session_state.entry_method == ENTRY_METHODS['fasta']:
|
|
|
|
| 78 |
|
| 79 |
# run model if we have any transcripts
|
| 80 |
elif len(transcripts) > 0:
|
|
|
|
| 81 |
st.session_state.transcripts = transcripts
|
| 82 |
|
| 83 |
|
|
|
|
| 89 |
st.session_state.disable_off_target_checkbox = True
|
| 90 |
if 'entry_method' not in st.session_state:
|
| 91 |
st.session_state.entry_method = ENTRY_METHODS['manual']
|
|
|
|
|
|
|
| 92 |
if 'transcripts' not in st.session_state:
|
| 93 |
st.session_state.transcripts = None
|
| 94 |
if 'input_error' not in st.session_state:
|
|
|
|
| 111 |
options=tuple(tiger.RUN_MODES.values()),
|
| 112 |
key='mode',
|
| 113 |
on_change=mode_change_callback,
|
| 114 |
+
disabled=st.session_state.transcripts is not None,
|
| 115 |
)
|
| 116 |
with col2:
|
| 117 |
st.checkbox(
|
| 118 |
label='Find off-target effects (slow)',
|
| 119 |
key='check_off_targets',
|
| 120 |
+
disabled=st.session_state.disable_off_target_checkbox or st.session_state.transcripts is not None
|
| 121 |
)
|
| 122 |
|
| 123 |
# transcript entry
|
|
|
|
| 126 |
label='How would you like to provide transcript(s) of interest?',
|
| 127 |
options=ENTRY_METHODS.values(),
|
| 128 |
key='entry_method',
|
| 129 |
+
disabled=st.session_state.transcripts is not None
|
| 130 |
)
|
| 131 |
if st.session_state.entry_method == ENTRY_METHODS['manual']:
|
| 132 |
st.text_input(
|
| 133 |
label='Enter a target transcript:',
|
| 134 |
key='manual_entry',
|
| 135 |
placeholder='Upper or lower case',
|
| 136 |
+
disabled=st.session_state.transcripts is not None
|
| 137 |
)
|
| 138 |
elif st.session_state.entry_method == ENTRY_METHODS['fasta']:
|
| 139 |
st.file_uploader(
|
| 140 |
label='Upload a fasta file:',
|
| 141 |
key='fasta_entry',
|
| 142 |
+
disabled=st.session_state.transcripts is not None
|
| 143 |
)
|
| 144 |
|
| 145 |
# runtime
|
| 146 |
with RUNTIME:
|
| 147 |
+
st.button(label='Get predictions!', on_click=initiate_run, disabled=st.session_state.transcripts is not None)
|
| 148 |
progress = st.empty()
|
| 149 |
|
| 150 |
# results
|
|
|
|
| 185 |
check_off_targets=st.session_state.check_off_targets,
|
| 186 |
status_update_fn=progress_update
|
| 187 |
)
|
|
|
|
| 188 |
st.session_state.transcripts = None
|
| 189 |
st.experimental_rerun()
|