import streamlit as st import requests import os #from auth import authenticator tok=os.getenv("TOK") def InitSession(): if "username" not in st.session_state: st.session_state.username="" if "projectname" not in st.session_state: st.session_state.projectname="" #if "loggedin" not in st.session_state: # st.session_state.loggedin=False #InitSession() def APP(): tab_map = { 0: "BIO ENGINEERING LAB @newMATTER", 1: "EXECUTED OPERATIONS @newMATTER", } tab_selection=st.pills( "TABS", options=tab_map.keys(), format_func=lambda option:tab_map[option], selection_mode="single" ) def SHOWTABS(): if tab_selection == 0 : option_map = { 0: "@OriginAI Nanobody Engineering:", 1: "@OriginAI Ops", 2: "Information" } selection = st.pills( "BIOLOGICS", options=option_map.keys(), format_func=lambda option: option_map[option], selection_mode="single", ) #match selection: if selection == 0: st.markdown("

Nanobody [CANCER targeted]

",unsafe_allow_html=True) #with st.expander("info"): #st.info("This Interface lets u specify a high level biological query (Protein Engineering Query) and execute the pipeline for the end product i.e Engineered Nanobody",icon=":material/info:") with st.form("bio",border=False): project_name=None target=None if st.session_state.projectname and st.session_state.projectname == "": with st.expander("set up the project before proceeding ."): project_name=st.text_input("Provide project name > ") bio_input = st.text_area( "Protein Engineering Query", placeholder="Type your query here." ) execute_button=st.form_submit_button("execute") if execute_button: ##st.session_state.projectname = project_name #st.session_state.username = uid if not project_name st.markdown(":orange-badge[⚠️ Set Projectname]") else: payload={ "uid":st.user.email , "pid":project_name, "target":target, "high_level_bio_query":bio_input } response=requests.post("https://thexforce-combat-backend.hf.space/application_layer_agent",json=payload,headers={ "Content-Type":"application/json", "Authorization":f"Bearer {tok}" }) plan_response=response.json() st.markdown(f"## {plan_response}") #else: # st.error("Please fill in both username and project name before submitting") if selection == 1: st.markdown("

Vaccine [Supported]

",unsafe_allow_html=True) with st.expander("info"): st.info("",icon=":material/info:") st.code("coming soon") if selection ==2: st.markdown("

Operation Details

",unsafe_allow_html=True) if tab_selection == 1: st.markdown("### ORIGINAI Bio Lab Operations") @st.cache_data(ttl=10) def fetch_ops(): response=requests.get(f"https://thexforce-combat-backend.hf.space/user/operations/{st.user.email}",headers={ "Content-Type":"application/json", "Authorization":f"Bearer {tok}" }) useroperations_json=response.json() return useroperations_json userops=fetch_ops() with st.expander("operations"): st.json(userops) ''' response=requests.get( f"https://thexforce-combat-backend.hf.space/{st.session_state.get('username')}/{projectname}/individual/experiment", headers={ "Content-Type":"application/json", "Authorization":f"Bearer {tok}" }) ie=response.json() st.json(ie) ''' if st.user.is_logged_in: if st.button("🚪 Logout"): st.logout() st.rerun() #Then show the main UI SHOWTABS() else: #Show login when NOT logged in st.info("Please log in to access the Bio Lab") if st.button("Log in"): st.login("auth0") st.stop()