Spaces:
Sleeping
Sleeping
Update ui.py
Browse files
ui.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import requests
|
| 3 |
-
import os
|
|
|
|
| 4 |
#from auth import authenticator
|
| 5 |
|
| 6 |
tok=os.getenv("TOK")
|
|
@@ -8,10 +9,20 @@ tok=os.getenv("TOK")
|
|
| 8 |
|
| 9 |
|
| 10 |
|
|
|
|
|
|
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
def APP():
|
| 17 |
|
|
@@ -58,8 +69,9 @@ def APP():
|
|
| 58 |
with st.form("bio",border=False):
|
| 59 |
|
| 60 |
project_name=None
|
| 61 |
-
|
| 62 |
|
|
|
|
| 63 |
|
| 64 |
def scan_for_project_availability(user_id):
|
| 65 |
request_url=f"https://thexforce-combat-backend.hf.space/{user_id}/projects"
|
|
@@ -103,7 +115,7 @@ def APP():
|
|
| 103 |
payload={
|
| 104 |
"uid":st.user.email ,
|
| 105 |
"pid":project_name or projectname,
|
| 106 |
-
"target":
|
| 107 |
"high_level_bio_query":bio_input
|
| 108 |
}
|
| 109 |
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import requests
|
| 3 |
+
import os
|
| 4 |
+
from gliner import GLiNER
|
| 5 |
#from auth import authenticator
|
| 6 |
|
| 7 |
tok=os.getenv("TOK")
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
+
def Target_Identification(userinput):
|
| 13 |
+
|
| 14 |
|
| 15 |
+
model = GLiNER.from_pretrained("Ihor/gliner-biomed-bi-small-v1.0")
|
| 16 |
+
labels = ["Protein"]
|
| 17 |
+
|
| 18 |
+
entities = model.predict_entities(text, labels, threshold=0.5)
|
| 19 |
|
| 20 |
+
|
| 21 |
+
result={}
|
| 22 |
+
for entity in entities:
|
| 23 |
+
if entity["label"] =="Protein":
|
| 24 |
+
return entity["text"]
|
| 25 |
|
|
|
|
| 26 |
|
| 27 |
def APP():
|
| 28 |
|
|
|
|
| 69 |
with st.form("bio",border=False):
|
| 70 |
|
| 71 |
project_name=None
|
| 72 |
+
|
| 73 |
|
| 74 |
+
|
| 75 |
|
| 76 |
def scan_for_project_availability(user_id):
|
| 77 |
request_url=f"https://thexforce-combat-backend.hf.space/{user_id}/projects"
|
|
|
|
| 115 |
payload={
|
| 116 |
"uid":st.user.email ,
|
| 117 |
"pid":project_name or projectname,
|
| 118 |
+
"target":Target_Identification(bio_input) or None,
|
| 119 |
"high_level_bio_query":bio_input
|
| 120 |
}
|
| 121 |
|