tiger / app.py
astirn's picture
manually merged latest tiger-exhibit files
54823be
raw
history blame
1 kB
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
st.title("Tiger gen prediction")
st.session_state['userInput'] = ""
st.session_state["userInput"] = st.text_input('type gen sequence')
csv_data = pd.DataFrame.from_dict({"Gene": [""], "res":[0.0]}).to_csv()
if len(st.session_state['userInput']) < 23:
st.write("Sorry your input length must be at least 23 bases. It is %s chars"%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)