Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -925,7 +925,7 @@ def process_chat_and_generate(message, history):
|
|
925 |
secondary_structure=None,
|
926 |
aa_bias=None,
|
927 |
aa_bias_potential=None,
|
928 |
-
num_steps="25",
|
929 |
noise="normal",
|
930 |
hydrophobic_target_score=str(params['hydrophobic_target_score']),
|
931 |
hydrophobic_potential="2",
|
@@ -936,8 +936,33 @@ def process_chat_and_generate(message, history):
|
|
936 |
rewrite_pdb=None
|
937 |
)
|
938 |
|
939 |
-
# 3.
|
940 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
941 |
|
942 |
# 4. ํ์ด๋ก ๋ฅ๋ ฅ์น ๊ณ์ฐ
|
943 |
stats = calculate_hero_stats(
|
@@ -947,7 +972,7 @@ def process_chat_and_generate(message, history):
|
|
947 |
hydrophobic_score=params['hydrophobic_target_score']
|
948 |
)
|
949 |
|
950 |
-
# 5. ์ค๋ช
์์ฑ
|
951 |
explanation = f"""
|
952 |
์์ฒญํ์ ๊ธฐ๋ฅ์ ๋ง๋ ๋จ๋ฐฑ์ง์ ์์ฑํ์ต๋๋ค:
|
953 |
|
@@ -960,23 +985,22 @@ def process_chat_and_generate(message, history):
|
|
960 |
- ๋ฒ ํ ์ํธ ๋น์จ: {params['strand_bias']*100:.1f}%
|
961 |
- ๋ฃจํ ๊ตฌ์กฐ ๋น์จ: {params['loop_bias']*100:.1f}%
|
962 |
- ์์์ฑ ์ ์: {params['hydrophobic_target_score']}
|
963 |
-
"""
|
964 |
|
965 |
-
|
966 |
-
|
967 |
-
{"role": "user", "content": message},
|
968 |
-
{"role": "assistant", "content": explanation}
|
969 |
-
]
|
970 |
|
971 |
-
#
|
972 |
return (
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
|
|
|
|
|
|
980 |
)
|
981 |
|
982 |
except Exception as e:
|
@@ -1495,9 +1519,6 @@ with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
|
1495 |
queue=False
|
1496 |
)
|
1497 |
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
# ์ฑ๋ด ์๋ต์ ๋ฐ๋ฅธ ๊ฒฐ๊ณผ ์
๋ฐ์ดํธ
|
1502 |
msg.submit(
|
1503 |
update_protein_display,
|
@@ -1514,6 +1535,26 @@ with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
|
1514 |
[chatbot])
|
1515 |
clear.click(lambda: None, None, chatbot, queue=False)
|
1516 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1517 |
# ์คํ
|
1518 |
demo.queue()
|
1519 |
demo.launch(debug=True)
|
|
|
925 |
secondary_structure=None,
|
926 |
aa_bias=None,
|
927 |
aa_bias_potential=None,
|
928 |
+
num_steps="25", # 25๋จ๊ณ ์ค์
|
929 |
noise="normal",
|
930 |
hydrophobic_target_score=str(params['hydrophobic_target_score']),
|
931 |
hydrophobic_potential="2",
|
|
|
936 |
rewrite_pdb=None
|
937 |
)
|
938 |
|
939 |
+
# 3. ๋ชจ๋ ๋จ๊ณ์ ๊ฒฐ๊ณผ ์์ง
|
940 |
+
final_result = None
|
941 |
+
for result in generator:
|
942 |
+
final_result = result
|
943 |
+
# ์ค๊ฐ ๊ฒฐ๊ณผ ์
๋ฐ์ดํธ (์ ํ์ )
|
944 |
+
yield (
|
945 |
+
history + [
|
946 |
+
{"role": "user", "content": message},
|
947 |
+
{"role": "assistant", "content": f"๋จ๋ฐฑ์ง ์์ฑ ์ค... {len(result[3].get_lines()) if result[3] else 0}๋จ๊ณ ์๋ฃ"}
|
948 |
+
],
|
949 |
+
create_radar_chart(calculate_hero_stats(
|
950 |
+
params['helix_bias'],
|
951 |
+
params['strand_bias'],
|
952 |
+
params['loop_bias'],
|
953 |
+
params['hydrophobic_target_score']
|
954 |
+
)),
|
955 |
+
f"๋จ๋ฐฑ์ง ์์ฑ ์งํ ์ค... {len(result[3].get_lines()) if result[3] else 0}๋จ๊ณ ์๋ฃ",
|
956 |
+
result[0], # output_seq
|
957 |
+
result[1], # output_pdb
|
958 |
+
result[2], # structure_view
|
959 |
+
result[3] # plddt_plot
|
960 |
+
)
|
961 |
+
|
962 |
+
if final_result is None:
|
963 |
+
raise Exception("์์ฑ ๊ฒฐ๊ณผ๊ฐ ์์ต๋๋ค")
|
964 |
+
|
965 |
+
output_seq, output_pdb, structure_view, plddt_plot = final_result
|
966 |
|
967 |
# 4. ํ์ด๋ก ๋ฅ๋ ฅ์น ๊ณ์ฐ
|
968 |
stats = calculate_hero_stats(
|
|
|
972 |
hydrophobic_score=params['hydrophobic_target_score']
|
973 |
)
|
974 |
|
975 |
+
# 5. ์ต์ข
์ค๋ช
์์ฑ
|
976 |
explanation = f"""
|
977 |
์์ฒญํ์ ๊ธฐ๋ฅ์ ๋ง๋ ๋จ๋ฐฑ์ง์ ์์ฑํ์ต๋๋ค:
|
978 |
|
|
|
985 |
- ๋ฒ ํ ์ํธ ๋น์จ: {params['strand_bias']*100:.1f}%
|
986 |
- ๋ฃจํ ๊ตฌ์กฐ ๋น์จ: {params['loop_bias']*100:.1f}%
|
987 |
- ์์์ฑ ์ ์: {params['hydrophobic_target_score']}
|
|
|
988 |
|
989 |
+
์์ฑ์ด ์๋ฃ๋์์ต๋๋ค. ์ด {len(plddt_plot.get_lines()) if plddt_plot else 0}๋จ๊ณ์ ์ต์ ํ๋ฅผ ์ํํ์ต๋๋ค.
|
990 |
+
"""
|
|
|
|
|
|
|
991 |
|
992 |
+
# 6. ์ต์ข
๊ฒฐ๊ณผ ๋ฐํ
|
993 |
return (
|
994 |
+
history + [
|
995 |
+
{"role": "user", "content": message},
|
996 |
+
{"role": "assistant", "content": explanation}
|
997 |
+
],
|
998 |
+
create_radar_chart(stats),
|
999 |
+
explanation,
|
1000 |
+
output_seq,
|
1001 |
+
output_pdb,
|
1002 |
+
structure_view,
|
1003 |
+
plddt_plot
|
1004 |
)
|
1005 |
|
1006 |
except Exception as e:
|
|
|
1519 |
queue=False
|
1520 |
)
|
1521 |
|
|
|
|
|
|
|
1522 |
# ์ฑ๋ด ์๋ต์ ๋ฐ๋ฅธ ๊ฒฐ๊ณผ ์
๋ฐ์ดํธ
|
1523 |
msg.submit(
|
1524 |
update_protein_display,
|
|
|
1535 |
[chatbot])
|
1536 |
clear.click(lambda: None, None, chatbot, queue=False)
|
1537 |
|
1538 |
+
# ์ด๋ฒคํธ ํธ๋ค๋ฌ ์์
|
1539 |
+
msg.submit(
|
1540 |
+
fn=process_chat_and_generate,
|
1541 |
+
inputs=[msg, chatbot],
|
1542 |
+
outputs=[
|
1543 |
+
chatbot,
|
1544 |
+
hero_stats,
|
1545 |
+
hero_description,
|
1546 |
+
output_seq,
|
1547 |
+
output_pdb,
|
1548 |
+
output_viewer,
|
1549 |
+
plddt_plot
|
1550 |
+
],
|
1551 |
+
show_progress=True
|
1552 |
+
).then(
|
1553 |
+
lambda: None, # ์งํ ์ํ ์ด๊ธฐํ
|
1554 |
+
None,
|
1555 |
+
None
|
1556 |
+
)
|
1557 |
+
|
1558 |
# ์คํ
|
1559 |
demo.queue()
|
1560 |
demo.launch(debug=True)
|