import streamlit as st import run as trun import pandas as pd def run_with_input(reset=False): if reset: st.write("") return 0 returned_x = trun.run(st.session_state["userInput"]) csv_x = returned_x.to_csv() st.write("model prediction: ", returned_x) return csv_x # title and instructions st.title('TIGER Cas13 Efficacy Prediction') st.session_state['userInput'] = "" st.session_state["userInput"] = st.text_input('Enter target transcript (or substring):') csv_data = pd.DataFrame.from_dict({'Target Site': [''], 'LFC': [0.0]}).to_csv() if len(st.session_state['userInput']) < trun.GUIDE_LEN: st.write('Transcript length must be >= 23 bases. It is {:d} chars'.format(len(st.session_state['userInput']))) run_with_input(reset=True) elif all([True if item in "ACGTacgt" else False for item in st.session_state['userInput']]): st.write('This is your sequence', st.session_state["userInput"]) csv_data = run_with_input() else: st.write("only ACTG is allowed") st.download_button(label="Download as CVS File", data=csv_data)