File size: 5,513 Bytes
b61c416
2e88125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b61c416
 
 
8a0150f
 
 
 
c3ebcce
 
b60b17e
318ecf5
c3ebcce
8a0150f
 
 
b61c416
 
 
f2dc9e2
b61c416
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1e012c1
1bd1714
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2e88125
1bd1714
 
 
1e012c1
 
1bd1714
 
d0ae7ed
 
bbff065
1bd1714
 
 
 
 
 
 
 
 
 
2e88125
1bd1714
 
 
 
 
2e88125
 
1bd1714
2e88125
1bd1714
 
 
2e88125
1bd1714
 
2e88125
 
1bd1714
 
 
 
b61c416
1bd1714
d0ae7ed
1bd1714
 
 
 
 
 
 
 
b61c416
2e88125
d0ae7ed
2e88125
 
 
 
 
 
 
 
 
b61c416
2e88125
b61c416
 
8422a80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import streamlit as st 
import requests
import os 

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=""


InitSession()




def APP():

        col1,col2=st.columns(2)
    
        with col1:
            
            #st.title("newMATTER")
            st.markdown("""
            <h2>new <i style='color:red'>MATTER</i> </h2>
            """,unsafe_allow_html=True)
            
        with col2:
            st.image("https://pub-e4d20ff4ef334a2894d440ac56d680db.r2.dev/flask.gif",width=190)
            
    
        tab1, tab2, tab3 = st.tabs(["PROTEIN ENGINEERING LAB", "EXECUTED OPERATIONS", "LAB OUTPUT"])
    
    
        def SHOWTABS():
            

            st.markdown("""
            <style>
                @keyframes blink {
                    0% { opacity: 1; }
                    50% { opacity: 0; }
                    100% { opacity: 1; }
                }

                .blinking-text {
                    animation: blink 2s infinite;
                    font-size: 20px;
                    font-weight: bold;
                    color: red;
                }
            </style>
            """, unsafe_allow_html=True)

            st.markdown('<div class="blinking-text"> CAUTION ! </div>', unsafe_allow_html=True)
            
            with tab1:


                option_map = {
                    0: ":material/pill:",
                    1: ":material/vaccines:",
    
                    }

                selection = st.pills(
                    "BIOLOGICS",
                    options=option_map.keys(),
                    format_func=lambda option: option_map[option],
                    selection_mode="single",
                    )
                match selection:
                    case 0:
                        st.markdown("<p style='color:white;background-color:orange'> Nanobody [CANCER targeted]</p>",unsafe_allow_html=True)
                        with st.form("bio",border=False):

                            uid=None
                            project_name=None
                    
                            with st.expander("setup",icon=":material/settings:"):
                                uid=st.text_input("enter username")
                                project_name=st.text_input("enter project name ")


                            if not uid or not project_name:
                                st.markdown(":orange-badge[⚠️ Set Username and Projectname]")

                        
                    
                            bio_input = st.text_area(
                                "Protein Engineering Query",
                                placeholder="Type your query here."
                            )
                            execute_button=st.form_submit_button("execute")
                    
                            if execute_button:
                                if uid and project_name:  # Only process if fields are filled
                                    st.session_state.projectname = project_name
                                    st.session_state.username = uid 
                            
                                    payload={
                                        "uid":uid,
                                        "pid":project_name,
                                        "high_level_bio_query":bio_input
                                    }

                            
                                    response=requests.post("https://thexforce-combat-backend.hf.space/bio_context_language_plan",json=payload,headers={
                    
                                        "Content-Type":"application/json",
                                        "Authorization":f"Bearer {tok}"
                                        })
                            
                                    plan_response=response.json()
                                    if plan_response.get("status")=="active":
                                
                                
                                        st.code(f"> operation execution successfull", language="rust")
                                        st.success("Task completed!")
                                    else:
                                        st.warning(">>>Error")

                                else:
                                    st.error("Please fill in both username and project name before submitting")


                    case 1:
                        st.markdown("<p style='color:white;background-color:orange'>Vaccine [Supported] </p>",unsafe_allow_html=True)
                        st.code("coming soon")
                        

            
            with tab2:
                st.markdown("### newMATTER Bio Lab Operations")
                response=requests.get(f"https://thexforce-combat-backend.hf.space/user/operations/{uid}",headers={
                    
                    "Content-Type":"application/json",
                    "Authorization":f"Bearer {tok}"
                })
                useroperations_json=response.json()
                with st.expander("operations"):
                    st.json(useroperations_json)
                
                
            with tab3:
                st.markdown("### newMATTER Bio Lab Outputs")

            
        SHOWTABS()