Junaidb commited on
Commit
2e88125
·
verified ·
1 Parent(s): b60b17e

Update ui.py

Browse files
Files changed (1) hide show
  1. ui.py +60 -12
ui.py CHANGED
@@ -1,4 +1,25 @@
1
  import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  def APP():
4
 
@@ -43,15 +64,18 @@ def APP():
43
  with tab1:
44
  with st.form("bio",border=False):
45
 
 
 
 
46
  with st.expander("setup",icon=":material/settings:"):
47
  uid=st.text_input("enter username")
48
  project_name=st.text_input("enter project name ")
49
 
50
 
51
- if uid and project_name == "":
52
- st.markdown(":orange-badge[⚠️ Set Username and Projectname ]")
53
  else:
54
- user_input = st.text_area(
55
  "Protein Engineering Query",
56
  placeholder="Type your query here."
57
  )
@@ -59,22 +83,46 @@ def APP():
59
 
60
  if execute_button:
61
 
62
- st.session_state.projectname = project_name
63
- output=None
64
- if output:
65
- with console_container:
66
- st.code(f"> {output}", language="rust")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  st.success("Task completed!")
68
  else:
69
- with console_container:
70
  st.warning(">>>Error")
71
 
72
 
73
  with tab2:
74
- st.markdown("### Operations")
75
-
 
 
 
 
 
 
 
 
 
76
  with tab3:
77
- st.markdown("### Output")
78
 
79
 
80
  SHOWTABS()
 
1
  import streamlit as st
2
+ import requests
3
+ import os
4
+
5
+ tok=os.getenv("TOK")
6
+
7
+
8
+
9
+
10
+ def InitSession():
11
+
12
+ if "username" not in st.session_state:
13
+ st.session_state.username=""
14
+
15
+ if "projectname" not in st.session_state:
16
+ st.session_state.projectname=""
17
+
18
+
19
+ InitSession()
20
+
21
+
22
+
23
 
24
  def APP():
25
 
 
64
  with tab1:
65
  with st.form("bio",border=False):
66
 
67
+ uid=None
68
+ project_name=None
69
+
70
  with st.expander("setup",icon=":material/settings:"):
71
  uid=st.text_input("enter username")
72
  project_name=st.text_input("enter project name ")
73
 
74
 
75
+ if not uid or not project_name:
76
+ st.markdown(":orange-badge[⚠️ Set Username and Projectname]")
77
  else:
78
+ bio_input = st.text_area(
79
  "Protein Engineering Query",
80
  placeholder="Type your query here."
81
  )
 
83
 
84
  if execute_button:
85
 
86
+ st.session_state.projectname =project_name
87
+ st.session_state.username=uid
88
+
89
+ payload={
90
+ "uid":uid,
91
+ "pid":project_name
92
+ "high_level_bio_query":bio_input
93
+ }
94
+
95
+
96
+ response=requests.post("https://thexforce-combat-backend.hf.space/bio_context_language_plan",json=payload,headers={
97
+
98
+ "Content-Type":"application/json",
99
+ "Authorization":f"Bearer {tok}"
100
+ })
101
+
102
+ plan_response=response.json()
103
+ if plan_response.get("status")=="active":
104
+
105
+
106
+ st.code(f"> operation execution successfull", language="rust")
107
  st.success("Task completed!")
108
  else:
 
109
  st.warning(">>>Error")
110
 
111
 
112
  with tab2:
113
+ st.markdown("### newMATTER Bio Lab Operations")
114
+ response=requests.get(f"https://thexforce-combat-backend.hf.space/user/operations/{user_id}",headers={
115
+
116
+ "Content-Type":"application/json",
117
+ "Authorization":f"Bearer {tok}"
118
+ })
119
+ useroperations_json=response.json()
120
+ with st.expander("operations"):
121
+ st.json(useroperations_json)
122
+
123
+
124
  with tab3:
125
+ st.markdown("### newMATTER Bio Lab Outputs")
126
 
127
 
128
  SHOWTABS()