Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -40,6 +40,7 @@ if not os.path.exists('./SEQDIFF_221219_equalTASKS_nostrSELFCOND_mod30.pt'):
|
|
40 |
os.system('wget http://files.ipd.uw.edu/pub/sequence_diffusion/checkpoints/SEQDIFF_221219_equalTASKS_nostrSELFCOND_mod30.pt')
|
41 |
print('Successfully Downloaded')
|
42 |
|
|
|
43 |
from openai import OpenAI
|
44 |
import gradio as gr
|
45 |
import json # json λͺ¨λ μΆκ°
|
@@ -58,6 +59,9 @@ from model.util import writepdb
|
|
58 |
from utils.inpainting_util import *
|
59 |
import os
|
60 |
|
|
|
|
|
|
|
61 |
# args λ‘λ
|
62 |
with open('./tmp/args.json', 'r') as f:
|
63 |
args = json.load(f)
|
@@ -1028,10 +1032,15 @@ def process_chat_and_generate(message, history):
|
|
1028 |
None, None, None, None, None, None
|
1029 |
)
|
1030 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1031 |
def extract_keywords(analysis):
|
1032 |
"""λΆμ ν
μ€νΈμμ ν€μλ μΆμΆ"""
|
1033 |
try:
|
1034 |
-
# κΈ°λ³Έ ν€μλ μΆμΆ
|
1035 |
keywords = []
|
1036 |
# μ£Όμ κΈ°λ₯ ν€μλ
|
1037 |
if "μΉλ£" in analysis: keywords.extend(["therapeutic", "binding"])
|
@@ -1048,7 +1057,7 @@ def extract_keywords(analysis):
|
|
1048 |
if "λ² ν" in analysis or "μνΈ" in analysis: keywords.append("sheet")
|
1049 |
if "루ν" in analysis: keywords.append("loop")
|
1050 |
|
1051 |
-
return list(set(keywords))
|
1052 |
except Exception as e:
|
1053 |
print(f"ν€μλ μΆμΆ μ€ μ€λ₯: {str(e)}")
|
1054 |
return []
|
@@ -1057,21 +1066,18 @@ def calculate_similarity(keywords, entry):
|
|
1057 |
"""ν€μλμ λ°μ΄ν°μ
νλͺ© κ°μ μ μ¬λ κ³μ°"""
|
1058 |
try:
|
1059 |
score = 0
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
print("Entry content:", entry)
|
1066 |
|
1067 |
for keyword in keywords:
|
1068 |
-
# μμ ν μ κ·Όμ μν μμ
|
1069 |
-
description = entry.get('description', '') if isinstance(entry, dict) else ''
|
1070 |
if keyword in description.lower():
|
1071 |
score += 2
|
1072 |
if keyword in sequence:
|
1073 |
score += 1
|
1074 |
-
if
|
1075 |
sec_structure = entry['secondary_structure']
|
1076 |
if keyword in ['helix'] and 'H' in sec_structure:
|
1077 |
score += 1
|
@@ -1081,10 +1087,24 @@ def calculate_similarity(keywords, entry):
|
|
1081 |
score += 1
|
1082 |
return score
|
1083 |
except Exception as e:
|
1084 |
-
print(f"μ μ¬λ κ³μ° μ€
|
1085 |
-
print("Entry:", entry)
|
1086 |
return 0
|
1087 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1088 |
|
1089 |
|
1090 |
def download_checkpoint_files():
|
|
|
40 |
os.system('wget http://files.ipd.uw.edu/pub/sequence_diffusion/checkpoints/SEQDIFF_221219_equalTASKS_nostrSELFCOND_mod30.pt')
|
41 |
print('Successfully Downloaded')
|
42 |
|
43 |
+
|
44 |
from openai import OpenAI
|
45 |
import gradio as gr
|
46 |
import json # json λͺ¨λ μΆκ°
|
|
|
59 |
from utils.inpainting_util import *
|
60 |
import os
|
61 |
|
62 |
+
rom Bio import SeqIO, Align
|
63 |
+
from Bio.Seq import Seq
|
64 |
+
|
65 |
# args λ‘λ
|
66 |
with open('./tmp/args.json', 'r') as f:
|
67 |
args = json.load(f)
|
|
|
1032 |
None, None, None, None, None, None
|
1033 |
)
|
1034 |
|
1035 |
+
# νμν λͺ¨λ μΆκ°
|
1036 |
+
import json
|
1037 |
+
from Bio import SeqIO, Align
|
1038 |
+
from Bio.Seq import Seq
|
1039 |
+
|
1040 |
+
# μμ λΆλΆμ μΆκ°
|
1041 |
def extract_keywords(analysis):
|
1042 |
"""λΆμ ν
μ€νΈμμ ν€μλ μΆμΆ"""
|
1043 |
try:
|
|
|
1044 |
keywords = []
|
1045 |
# μ£Όμ κΈ°λ₯ ν€μλ
|
1046 |
if "μΉλ£" in analysis: keywords.extend(["therapeutic", "binding"])
|
|
|
1057 |
if "λ² ν" in analysis or "μνΈ" in analysis: keywords.append("sheet")
|
1058 |
if "루ν" in analysis: keywords.append("loop")
|
1059 |
|
1060 |
+
return list(set(keywords))
|
1061 |
except Exception as e:
|
1062 |
print(f"ν€μλ μΆμΆ μ€ μ€λ₯: {str(e)}")
|
1063 |
return []
|
|
|
1066 |
"""ν€μλμ λ°μ΄ν°μ
νλͺ© κ°μ μ μ¬λ κ³μ°"""
|
1067 |
try:
|
1068 |
score = 0
|
1069 |
+
if not entry or not isinstance(entry, dict):
|
1070 |
+
return 0
|
1071 |
+
|
1072 |
+
sequence = entry.get('sequence', '').lower()
|
1073 |
+
description = entry.get('description', '')
|
|
|
1074 |
|
1075 |
for keyword in keywords:
|
|
|
|
|
1076 |
if keyword in description.lower():
|
1077 |
score += 2
|
1078 |
if keyword in sequence:
|
1079 |
score += 1
|
1080 |
+
if 'secondary_structure' in entry:
|
1081 |
sec_structure = entry['secondary_structure']
|
1082 |
if keyword in ['helix'] and 'H' in sec_structure:
|
1083 |
score += 1
|
|
|
1087 |
score += 1
|
1088 |
return score
|
1089 |
except Exception as e:
|
1090 |
+
print(f"μ μ¬λ κ³μ° μ€ μ€λ₯: {str(e)}")
|
|
|
1091 |
return 0
|
1092 |
|
1093 |
+
# plddt_data λ³μ μΆκ°
|
1094 |
+
plddt_data = []
|
1095 |
+
|
1096 |
+
# μμ ν둬ννΈ μ²λ¦¬ ν¨μ μμ
|
1097 |
+
def use_example(example):
|
1098 |
+
try:
|
1099 |
+
if example:
|
1100 |
+
return example
|
1101 |
+
return ""
|
1102 |
+
except Exception as e:
|
1103 |
+
print(f"μμ μ²λ¦¬ μ€ μ€λ₯: {str(e)}")
|
1104 |
+
return ""
|
1105 |
+
|
1106 |
+
# μ΄λ²€νΈ νΈλ€λ¬μμ νμν λ³μλ€ μ μ
|
1107 |
+
current_protein_result = None
|
1108 |
|
1109 |
|
1110 |
def download_checkpoint_files():
|