Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import os,sys
|
2 |
-
|
3 |
# install required packages
|
4 |
os.system('pip install plotly') # plotly ์ค์น
|
5 |
os.system('pip install matplotlib') # matplotlib ์ค์น
|
@@ -909,6 +909,8 @@ def update_protein_display(chat_response):
|
|
909 |
}
|
910 |
return None
|
911 |
|
|
|
|
|
912 |
def process_chat_and_generate(message, history):
|
913 |
try:
|
914 |
# 1. ํ๋กฌํํธ ๋ถ์ ๋ฐ ํ๋ผ๋ฏธํฐ ์ค์
|
@@ -926,7 +928,7 @@ def process_chat_and_generate(message, history):
|
|
926 |
secondary_structure=None,
|
927 |
aa_bias=None,
|
928 |
aa_bias_potential=None,
|
929 |
-
num_steps="25",
|
930 |
noise="normal",
|
931 |
hydrophobic_target_score=str(params['hydrophobic_target_score']),
|
932 |
hydrophobic_potential="2",
|
@@ -937,15 +939,21 @@ def process_chat_and_generate(message, history):
|
|
937 |
rewrite_pdb=None
|
938 |
)
|
939 |
|
940 |
-
|
941 |
# 3. ๋ชจ๋ ๋จ๊ณ์ ๊ฒฐ๊ณผ ์์ง
|
942 |
final_result = None
|
943 |
-
plddt_data = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
944 |
|
945 |
for result in generator:
|
946 |
final_result = result
|
947 |
if result[3]: # plddt_plot์ด ์กด์ฌํ๋ ๊ฒฝ์ฐ
|
948 |
-
# matplotlib ๊ทธ๋ํ์์ ๋ฐ์ดํฐ ์ถ์ถ
|
949 |
ax = result[3].gca()
|
950 |
if ax.lines:
|
951 |
line = ax.lines[0]
|
@@ -957,12 +965,7 @@ def process_chat_and_generate(message, history):
|
|
957 |
{"role": "user", "content": message},
|
958 |
{"role": "assistant", "content": f"๋จ๋ฐฑ์ง ์์ฑ ์ค... {len(plddt_data)}๋จ๊ณ ์๋ฃ"}
|
959 |
],
|
960 |
-
create_radar_chart(
|
961 |
-
params['helix_bias'],
|
962 |
-
params['strand_bias'],
|
963 |
-
params['loop_bias'],
|
964 |
-
params['hydrophobic_target_score']
|
965 |
-
)),
|
966 |
f"๋จ๋ฐฑ์ง ์์ฑ ์งํ ์ค... {len(plddt_data)}๋จ๊ณ ์๋ฃ",
|
967 |
result[0], # output_seq
|
968 |
result[1], # output_pdb
|
@@ -990,7 +993,7 @@ def process_chat_and_generate(message, history):
|
|
990 |
- ์์์ฑ ์ ์: {params['hydrophobic_target_score']}
|
991 |
|
992 |
์์ฑ์ด ์๋ฃ๋์์ต๋๋ค. ์ด {len(plddt_data)}๋จ๊ณ์ ์ต์ ํ๋ฅผ ์ํํ์ต๋๋ค.
|
993 |
-
์ต์ข
์์ ์ฑ ์ ์: {np.mean(plddt_data):.2f}
|
994 |
"""
|
995 |
|
996 |
# 6. ์ต์ข
๊ฒฐ๊ณผ ๋ฐํ
|
|
|
1 |
import os,sys
|
2 |
+
import traceback # ์๋จ์ ์ถ๊ฐ
|
3 |
# install required packages
|
4 |
os.system('pip install plotly') # plotly ์ค์น
|
5 |
os.system('pip install matplotlib') # matplotlib ์ค์น
|
|
|
909 |
}
|
910 |
return None
|
911 |
|
912 |
+
|
913 |
+
|
914 |
def process_chat_and_generate(message, history):
|
915 |
try:
|
916 |
# 1. ํ๋กฌํํธ ๋ถ์ ๋ฐ ํ๋ผ๋ฏธํฐ ์ค์
|
|
|
928 |
secondary_structure=None,
|
929 |
aa_bias=None,
|
930 |
aa_bias_potential=None,
|
931 |
+
num_steps="25",
|
932 |
noise="normal",
|
933 |
hydrophobic_target_score=str(params['hydrophobic_target_score']),
|
934 |
hydrophobic_potential="2",
|
|
|
939 |
rewrite_pdb=None
|
940 |
)
|
941 |
|
|
|
942 |
# 3. ๋ชจ๋ ๋จ๊ณ์ ๊ฒฐ๊ณผ ์์ง
|
943 |
final_result = None
|
944 |
+
plddt_data = []
|
945 |
+
|
946 |
+
# ํ์ด๋ก ๋ฅ๋ ฅ์น ๊ณ์ฐ
|
947 |
+
stats = calculate_hero_stats(
|
948 |
+
helix_bias=params['helix_bias'],
|
949 |
+
strand_bias=params['strand_bias'],
|
950 |
+
loop_bias=params['loop_bias'],
|
951 |
+
hydrophobic_score=float(params['hydrophobic_target_score'])
|
952 |
+
)
|
953 |
|
954 |
for result in generator:
|
955 |
final_result = result
|
956 |
if result[3]: # plddt_plot์ด ์กด์ฌํ๋ ๊ฒฝ์ฐ
|
|
|
957 |
ax = result[3].gca()
|
958 |
if ax.lines:
|
959 |
line = ax.lines[0]
|
|
|
965 |
{"role": "user", "content": message},
|
966 |
{"role": "assistant", "content": f"๋จ๋ฐฑ์ง ์์ฑ ์ค... {len(plddt_data)}๋จ๊ณ ์๋ฃ"}
|
967 |
],
|
968 |
+
create_radar_chart(stats),
|
|
|
|
|
|
|
|
|
|
|
969 |
f"๋จ๋ฐฑ์ง ์์ฑ ์งํ ์ค... {len(plddt_data)}๋จ๊ณ ์๋ฃ",
|
970 |
result[0], # output_seq
|
971 |
result[1], # output_pdb
|
|
|
993 |
- ์์์ฑ ์ ์: {params['hydrophobic_target_score']}
|
994 |
|
995 |
์์ฑ์ด ์๋ฃ๋์์ต๋๋ค. ์ด {len(plddt_data)}๋จ๊ณ์ ์ต์ ํ๋ฅผ ์ํํ์ต๋๋ค.
|
996 |
+
์ต์ข
์์ ์ฑ ์ ์: {np.mean(plddt_data) if plddt_data else 0:.2f}
|
997 |
"""
|
998 |
|
999 |
# 6. ์ต์ข
๊ฒฐ๊ณผ ๋ฐํ
|