Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,25 @@
|
|
1 |
import os,sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
# install required packages
|
4 |
-
os.system('pip install plotly')
|
5 |
-
os.system('pip install matplotlib')
|
6 |
os.system('pip install dgl==1.0.2+cu116 -f https://data.dgl.ai/wheels/cu116/repo.html')
|
7 |
os.environ["DGLBACKEND"] = "pytorch"
|
8 |
print('Modules installed')
|
9 |
|
|
|
10 |
import plotly.graph_objects as go
|
11 |
import numpy as np
|
12 |
-
import gradio as gr
|
13 |
import py3Dmol
|
14 |
from io import StringIO
|
15 |
import json
|
@@ -21,59 +31,56 @@ from utils.parsers_inference import parse_pdb
|
|
21 |
from model.util import writepdb
|
22 |
from utils.inpainting_util import *
|
23 |
|
24 |
-
#
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
-
# manually set checkpoint to load
|
69 |
-
args['checkpoint'] = None
|
70 |
-
args['dump_trb'] = False
|
71 |
-
args['dump_args'] = True
|
72 |
-
args['save_best_plddt'] = True
|
73 |
-
args['T'] = 25
|
74 |
-
args['strand_bias'] = 0.0
|
75 |
-
args['loop_bias'] = 0.0
|
76 |
-
args['helix_bias'] = 0.0
|
77 |
|
78 |
def protein_diffusion_model(sequence, seq_len, helix_bias, strand_bias, loop_bias,
|
79 |
secondary_structure, aa_bias, aa_bias_potential,
|
@@ -543,11 +550,21 @@ def combined_generation(name, strength, flexibility, speed, defense, size, abili
|
|
543 |
None
|
544 |
)
|
545 |
|
|
|
546 |
with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
547 |
with gr.Row():
|
548 |
-
|
549 |
-
|
550 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
with gr.Tabs():
|
552 |
with gr.TabItem("๐ฆธโโ๏ธ ํ์ด๋ก ๋์์ธ"):
|
553 |
gr.Markdown("""
|
@@ -616,9 +633,6 @@ with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
|
616 |
# ์์ฑ ๋ฒํผ
|
617 |
create_btn = gr.Button("๐งฌ ํ์ด๋ก ์์ฑ!", variant="primary", scale=2)
|
618 |
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
with gr.TabItem("๐งฌ ํ์ด๋ก DNA ์ค๊ณ"):
|
623 |
gr.Markdown("""
|
624 |
### ๐งช ํ์ด๋ก DNA ๊ณ ๊ธ ์ค์
|
@@ -681,7 +695,6 @@ with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
|
681 |
visible=True
|
682 |
)
|
683 |
|
684 |
-
# ์๋ฏธ๋
ธ์ฐ ๊ตฌ์ฑ ์ค์ ์ถ๊ฐ
|
685 |
with gr.Accordion(label='๐งฌ DNA ๊ตฌ์ฑ ์ค์ ', open=False):
|
686 |
gr.Markdown("""
|
687 |
ํน์ ์๋ฏธ๋
ธ์ฐ์ ๋น์จ์ ์กฐ์ ํ์ฌ ํ์ด๋ก์ ํน์ฑ์ ๊ฐํํ ์ ์์ต๋๋ค.
|
@@ -699,7 +712,6 @@ with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
|
699 |
placeholder='1.0-5.0 ์ฌ์ด ๊ฐ ์
๋ ฅ'
|
700 |
)
|
701 |
|
702 |
-
# ํ๊ฒฝ ์ ์๋ ฅ ์ค์ ์ถ๊ฐ
|
703 |
with gr.Accordion(label='๐ ํ๊ฒฝ ์ ์๋ ฅ ์ค์ ', open=False):
|
704 |
gr.Markdown("""
|
705 |
ํ์ด๋ก์ ํ๊ฒฝ ์ ์๋ ฅ์ ์กฐ์ ํฉ๋๋ค.
|
@@ -717,7 +729,6 @@ with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
|
717 |
placeholder='1.0-2.0 ์ฌ์ด ๊ฐ ์
๋ ฅ'
|
718 |
)
|
719 |
|
720 |
-
# ํ์ฐ ๋งค๊ฐ๋ณ์ ์ค์
|
721 |
with gr.Accordion(label='โ๏ธ ๊ณ ๊ธ ์ค์ ', open=False):
|
722 |
gr.Markdown("""
|
723 |
DNA ์์ฑ ๊ณผ์ ์ ์ธ๋ถ ๋งค๊ฐ๋ณ์๋ฅผ ์กฐ์ ํฉ๋๋ค.
|
@@ -734,9 +745,7 @@ with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
|
734 |
value='normal'
|
735 |
)
|
736 |
|
737 |
-
design_btn = gr.Button("๐งฌ DNA ์ค๊ณ ์์ฑ!", variant="primary", scale=2)
|
738 |
-
|
739 |
-
|
740 |
|
741 |
with gr.TabItem("๐งช ํ์ด๋ก ์ ์ ์ ๊ฐํ"):
|
742 |
gr.Markdown("""
|
@@ -792,21 +801,14 @@ with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
|
792 |
pssm = gr.File(label='๋ถ์๋ ๊ฐ๋ฌธ ํน์ฑ')
|
793 |
pssm_view = gr.Plot(label='๊ฐ๋ฌธ ํน์ฑ ๋ถ์ ๊ฒฐ๊ณผ')
|
794 |
pssm_gen_btn = gr.Button("โจ ๊ฐ๋ฌธ ํน์ฑ ๋ถ์", variant="secondary")
|
795 |
-
inherit_btn = gr.Button("๐ ๊ฐ๋ฌธ์ ํ ๊ณ์น!", variant="primary", scale=2)
|
796 |
-
|
797 |
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
with gr.Column():
|
802 |
gr.Markdown("## ๐ฆธโโ๏ธ ํ์ด๋ก ํ๋กํ")
|
803 |
-
|
804 |
-
# ๋ฅ๋ ฅ์น ๋ ์ด๋ ์ฐจํธ
|
805 |
hero_stats = gr.Plot(label="๋ฅ๋ ฅ์น ๋ถ์")
|
806 |
-
|
807 |
-
# ํ์ด๋ก ์ค๋ช
|
808 |
hero_description = gr.Textbox(label="ํ์ด๋ก ํน์ฑ", lines=3)
|
809 |
-
|
810 |
gr.Markdown("## ๐งฌ ํ์ด๋ก DNA ๋ถ์ ๊ฒฐ๊ณผ")
|
811 |
gr.Markdown("#### โก DNA ์์ ์ฑ ์ ์")
|
812 |
plddt_plot = gr.Plot(label='์์ ์ฑ ๋ถ์')
|
@@ -818,6 +820,11 @@ with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
|
818 |
output_viewer = gr.HTML()
|
819 |
|
820 |
# ์ด๋ฒคํธ ์ฐ๊ฒฐ
|
|
|
|
|
|
|
|
|
|
|
821 |
seq_opt.change(
|
822 |
fn=toggle_seq_input,
|
823 |
inputs=[seq_opt],
|
@@ -832,85 +839,61 @@ with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
|
832 |
queue=False
|
833 |
)
|
834 |
|
835 |
-
preview_btn.click(
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
create_btn.click(
|
840 |
-
combined_generation,
|
841 |
-
inputs=[
|
842 |
-
hero_name, strength, flexibility, speed, defense, hero_size, special_ability,
|
843 |
-
sequence, seq_len, helix_bias, strand_bias, loop_bias,
|
844 |
-
secondary_structure, aa_bias, aa_bias_potential,
|
845 |
-
num_steps, noise, hydrophobic_target_score, hydrophobic_potential,
|
846 |
-
contigs, pssm, seq_mask, str_mask, rewrite_pdb
|
847 |
-
],
|
848 |
-
outputs=[
|
849 |
-
hero_stats,
|
850 |
-
hero_description,
|
851 |
-
output_seq,
|
852 |
-
output_pdb,
|
853 |
-
output_viewer,
|
854 |
-
plddt_plot
|
855 |
-
]
|
856 |
)
|
857 |
|
858 |
-
|
859 |
-
|
860 |
-
inputs=[
|
861 |
-
|
862 |
-
sequence, seq_len, helix_bias, strand_bias, loop_bias,
|
863 |
-
secondary_structure, aa_bias, aa_bias_potential,
|
864 |
-
num_steps, noise, hydrophobic_target_score, hydrophobic_potential,
|
865 |
-
contigs, pssm, seq_mask, str_mask, rewrite_pdb
|
866 |
-
],
|
867 |
-
outputs=[
|
868 |
-
hero_stats,
|
869 |
-
hero_description,
|
870 |
-
output_seq,
|
871 |
-
output_pdb,
|
872 |
-
output_viewer,
|
873 |
-
plddt_plot
|
874 |
-
]
|
875 |
)
|
876 |
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
895 |
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
secondary_structure, aa_bias, aa_bias_potential,
|
902 |
-
num_steps, noise, hydrophobic_target_score, hydrophobic_potential,
|
903 |
-
contigs, pssm, seq_mask, str_mask, rewrite_pdb
|
904 |
-
],
|
905 |
-
outputs=[
|
906 |
-
hero_stats,
|
907 |
-
hero_description,
|
908 |
-
output_seq,
|
909 |
-
output_pdb,
|
910 |
-
output_viewer,
|
911 |
-
plddt_plot
|
912 |
-
]
|
913 |
)
|
914 |
|
|
|
915 |
demo.queue()
|
916 |
-
demo.launch(debug=True)
|
|
|
1 |
import os,sys
|
2 |
+
from transformers import pipeline
|
3 |
+
from datasets import load_dataset
|
4 |
+
import gradio as gr
|
5 |
+
from dotenv import load_dotenv
|
6 |
+
|
7 |
+
# ํ๊ฒฝ ๋ณ์ ๋ก๋
|
8 |
+
load_dotenv()
|
9 |
+
HF_TOKEN = os.getenv("HF_TOKEN")
|
10 |
+
if not HF_TOKEN:
|
11 |
+
raise ValueError("HF_TOKEN not found in environment variables")
|
12 |
|
13 |
# install required packages
|
14 |
+
os.system('pip install plotly')
|
15 |
+
os.system('pip install matplotlib')
|
16 |
os.system('pip install dgl==1.0.2+cu116 -f https://data.dgl.ai/wheels/cu116/repo.html')
|
17 |
os.environ["DGLBACKEND"] = "pytorch"
|
18 |
print('Modules installed')
|
19 |
|
20 |
+
# ๊ธฐ์กด import๋ฌธ๋ค ์ ์ง
|
21 |
import plotly.graph_objects as go
|
22 |
import numpy as np
|
|
|
23 |
import py3Dmol
|
24 |
from io import StringIO
|
25 |
import json
|
|
|
31 |
from model.util import writepdb
|
32 |
from utils.inpainting_util import *
|
33 |
|
34 |
+
# ์๋ก์ด ๋ชจ๋ธ๊ณผ ๋ฐ์ดํฐ์
๋ก๋
|
35 |
+
pipe = pipeline("text-generation",
|
36 |
+
model="CohereForAI/c4ai-command-r-plus-08-2024",
|
37 |
+
token=HF_TOKEN)
|
38 |
+
ds = load_dataset("lamm-mit/protein_secondary_structure_from_PDB",
|
39 |
+
token=HF_TOKEN)
|
40 |
+
|
41 |
+
# ์ฑ๋ด ๋ฐ ๋จ๋ฐฑ์ง ์์ฑ ๊ด๋ จ ํจ์๋ค
|
42 |
+
def process_chat(message, history):
|
43 |
+
messages = [{"role": "user", "content": message}]
|
44 |
+
response = pipe(messages)[0]['generated_text']
|
45 |
+
|
46 |
+
if any(keyword in message.lower() for keyword in ['protein', 'generate', '๋จ๋ฐฑ์ง', '์์ฑ']):
|
47 |
+
relevant_data = search_protein_data(message)
|
48 |
+
params = extract_parameters(response, relevant_data)
|
49 |
+
protein_result = generate_protein(params)
|
50 |
+
explanation = generate_explanation(protein_result, params)
|
51 |
+
return response + "\n\n" + explanation
|
52 |
+
|
53 |
+
return response
|
54 |
+
|
55 |
+
def search_protein_data(query):
|
56 |
+
relevant_entries = []
|
57 |
+
for entry in ds['train']:
|
58 |
+
if any(keyword in entry['sequence'].lower() for keyword in query.lower().split()):
|
59 |
+
relevant_entries.append(entry)
|
60 |
+
return relevant_entries
|
61 |
+
|
62 |
+
def extract_parameters(llm_response, dataset_info):
|
63 |
+
params = {
|
64 |
+
'sequence_length': 100,
|
65 |
+
'helix_bias': 0.02,
|
66 |
+
'strand_bias': 0.02,
|
67 |
+
'loop_bias': 0.1,
|
68 |
+
'hydrophobic_target_score': 0
|
69 |
+
}
|
70 |
+
return params
|
71 |
+
|
72 |
+
def generate_explanation(result, params):
|
73 |
+
explanation = f"""
|
74 |
+
์์ฑ๋ ๋จ๋ฐฑ์ง ๋ถ์:
|
75 |
+
- ๊ธธ์ด: {params['sequence_length']} ์๋ฏธ๋
ธ์ฐ
|
76 |
+
- ๊ตฌ์กฐ์ ํน์ง:
|
77 |
+
* ์ํ ๋์ ๋น์จ: {params['helix_bias']*100}%
|
78 |
+
* ๋ฒ ํ ์ํธ ๋น์จ: {params['strand_bias']*100}%
|
79 |
+
* ๋ฃจํ ๊ตฌ์กฐ ๋น์จ: {params['loop_bias']*100}%
|
80 |
+
- ํน์ ๊ธฐ๋ฅ: {result.get('special_features', '์์')}
|
81 |
+
"""
|
82 |
+
return explanation
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
def protein_diffusion_model(sequence, seq_len, helix_bias, strand_bias, loop_bias,
|
86 |
secondary_structure, aa_bias, aa_bias_potential,
|
|
|
550 |
None
|
551 |
)
|
552 |
|
553 |
+
# Gradio ์ธํฐํ์ด์ค ์์
|
554 |
with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
555 |
with gr.Row():
|
556 |
+
# ์ผ์ชฝ ์ด: ์ฑ๋ด ๋ฐ ์ปจํธ๋กค ํจ๋
|
557 |
+
with gr.Column(scale=1):
|
558 |
+
# ์ฑ๋ด ์ธํฐํ์ด์ค
|
559 |
+
gr.Markdown("# ๐ค AI ๋จ๋ฐฑ์ง ์ค๊ณ ๋์ฐ๋ฏธ")
|
560 |
+
chatbot = gr.Chatbot()
|
561 |
+
msg = gr.Textbox(
|
562 |
+
label="๋ช
๋ น์ ์
๋ ฅํ์ธ์ (์: COVID-19๋ฅผ ์น๋ฃํ ์ ์๋ ๋จ๋ฐฑ์ง์ ์์ฑํด์ฃผ์ธ์)",
|
563 |
+
placeholder="์ฌ๊ธฐ์ ์
๋ ฅํ์ธ์..."
|
564 |
+
)
|
565 |
+
clear = gr.Button("๋ํ ๋ด์ฉ ์ง์ฐ๊ธฐ")
|
566 |
+
|
567 |
+
# ํญ ์ธํฐํ์ด์ค
|
568 |
with gr.Tabs():
|
569 |
with gr.TabItem("๐ฆธโโ๏ธ ํ์ด๋ก ๋์์ธ"):
|
570 |
gr.Markdown("""
|
|
|
633 |
# ์์ฑ ๋ฒํผ
|
634 |
create_btn = gr.Button("๐งฌ ํ์ด๋ก ์์ฑ!", variant="primary", scale=2)
|
635 |
|
|
|
|
|
|
|
636 |
with gr.TabItem("๐งฌ ํ์ด๋ก DNA ์ค๊ณ"):
|
637 |
gr.Markdown("""
|
638 |
### ๐งช ํ์ด๋ก DNA ๊ณ ๊ธ ์ค์
|
|
|
695 |
visible=True
|
696 |
)
|
697 |
|
|
|
698 |
with gr.Accordion(label='๐งฌ DNA ๊ตฌ์ฑ ์ค์ ', open=False):
|
699 |
gr.Markdown("""
|
700 |
ํน์ ์๋ฏธ๋
ธ์ฐ์ ๋น์จ์ ์กฐ์ ํ์ฌ ํ์ด๋ก์ ํน์ฑ์ ๊ฐํํ ์ ์์ต๋๋ค.
|
|
|
712 |
placeholder='1.0-5.0 ์ฌ์ด ๊ฐ ์
๋ ฅ'
|
713 |
)
|
714 |
|
|
|
715 |
with gr.Accordion(label='๐ ํ๊ฒฝ ์ ์๋ ฅ ์ค์ ', open=False):
|
716 |
gr.Markdown("""
|
717 |
ํ์ด๋ก์ ํ๊ฒฝ ์ ์๋ ฅ์ ์กฐ์ ํฉ๋๋ค.
|
|
|
729 |
placeholder='1.0-2.0 ์ฌ์ด ๊ฐ ์
๋ ฅ'
|
730 |
)
|
731 |
|
|
|
732 |
with gr.Accordion(label='โ๏ธ ๊ณ ๊ธ ์ค์ ', open=False):
|
733 |
gr.Markdown("""
|
734 |
DNA ์์ฑ ๊ณผ์ ์ ์ธ๋ถ ๋งค๊ฐ๋ณ์๋ฅผ ์กฐ์ ํฉ๋๋ค.
|
|
|
745 |
value='normal'
|
746 |
)
|
747 |
|
748 |
+
design_btn = gr.Button("๐งฌ DNA ์ค๊ณ ์์ฑ!", variant="primary", scale=2)
|
|
|
|
|
749 |
|
750 |
with gr.TabItem("๐งช ํ์ด๋ก ์ ์ ์ ๊ฐํ"):
|
751 |
gr.Markdown("""
|
|
|
801 |
pssm = gr.File(label='๋ถ์๋ ๊ฐ๋ฌธ ํน์ฑ')
|
802 |
pssm_view = gr.Plot(label='๊ฐ๋ฌธ ํน์ฑ ๋ถ์ ๊ฒฐ๊ณผ')
|
803 |
pssm_gen_btn = gr.Button("โจ ๊ฐ๋ฌธ ํน์ฑ ๋ถ์", variant="secondary")
|
804 |
+
inherit_btn = gr.Button("๐ ๊ฐ๋ฌธ์ ํ ๊ณ์น!", variant="primary", scale=2)
|
|
|
805 |
|
806 |
+
# ์ค๋ฅธ์ชฝ ์ด: ๊ฒฐ๊ณผ ํ์
|
807 |
+
with gr.Column(scale=1):
|
|
|
|
|
808 |
gr.Markdown("## ๐ฆธโโ๏ธ ํ์ด๋ก ํ๋กํ")
|
|
|
|
|
809 |
hero_stats = gr.Plot(label="๋ฅ๋ ฅ์น ๋ถ์")
|
|
|
|
|
810 |
hero_description = gr.Textbox(label="ํ์ด๋ก ํน์ฑ", lines=3)
|
811 |
+
|
812 |
gr.Markdown("## ๐งฌ ํ์ด๋ก DNA ๋ถ์ ๊ฒฐ๊ณผ")
|
813 |
gr.Markdown("#### โก DNA ์์ ์ฑ ์ ์")
|
814 |
plddt_plot = gr.Plot(label='์์ ์ฑ ๋ถ์')
|
|
|
820 |
output_viewer = gr.HTML()
|
821 |
|
822 |
# ์ด๋ฒคํธ ์ฐ๊ฒฐ
|
823 |
+
# ์ฑ๋ด ์ด๋ฒคํธ
|
824 |
+
msg.submit(process_chat, [msg, chatbot], [chatbot])
|
825 |
+
clear.click(lambda: None, None, chatbot, queue=False)
|
826 |
+
|
827 |
+
# UI ์ปจํธ๋กค ์ด๋ฒคํธ
|
828 |
seq_opt.change(
|
829 |
fn=toggle_seq_input,
|
830 |
inputs=[seq_opt],
|
|
|
839 |
queue=False
|
840 |
)
|
841 |
|
842 |
+
preview_btn.click(
|
843 |
+
get_motif_preview,
|
844 |
+
inputs=[pdb_id_code, contigs],
|
845 |
+
outputs=[preview_viewer, rewrite_pdb]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
846 |
)
|
847 |
|
848 |
+
pssm_gen_btn.click(
|
849 |
+
get_pssm,
|
850 |
+
inputs=[fasta_msa, input_pssm],
|
851 |
+
outputs=[pssm_view, pssm]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
852 |
)
|
853 |
|
854 |
+
# ์ฑ๋ด ๊ธฐ๋ฐ ๋จ๋ฐฑ์ง ์์ฑ ๊ฒฐ๊ณผ ์
๋ฐ์ดํธ
|
855 |
+
def update_protein_display(chat_response):
|
856 |
+
if "์์ฑ๋ ๋จ๋ฐฑ์ง ๋ถ์" in chat_response:
|
857 |
+
params = extract_parameters_from_chat(chat_response)
|
858 |
+
result = generate_protein(params)
|
859 |
+
return {
|
860 |
+
hero_stats: create_radar_chart(calculate_hero_stats(params)),
|
861 |
+
hero_description: chat_response,
|
862 |
+
output_seq: result[0],
|
863 |
+
output_pdb: result[1],
|
864 |
+
output_viewer: display_pdb(result[1]),
|
865 |
+
plddt_plot: result[3]
|
866 |
+
}
|
867 |
+
return None
|
868 |
+
|
869 |
+
# ๊ฐ ์์ฑ ๋ฒํผ ์ด๋ฒคํธ ์ฐ๊ฒฐ
|
870 |
+
for btn in [create_btn, design_btn, enhance_btn, inherit_btn]:
|
871 |
+
btn.click(
|
872 |
+
combined_generation,
|
873 |
+
inputs=[
|
874 |
+
hero_name, strength, flexibility, speed, defense, hero_size, special_ability,
|
875 |
+
sequence, seq_len, helix_bias, strand_bias, loop_bias,
|
876 |
+
secondary_structure, aa_bias, aa_bias_potential,
|
877 |
+
num_steps, noise, hydrophobic_target_score, hydrophobic_potential,
|
878 |
+
contigs, pssm, seq_mask, str_mask, rewrite_pdb
|
879 |
+
],
|
880 |
+
outputs=[
|
881 |
+
hero_stats,
|
882 |
+
hero_description,
|
883 |
+
output_seq,
|
884 |
+
output_pdb,
|
885 |
+
output_viewer,
|
886 |
+
plddt_plot
|
887 |
+
]
|
888 |
+
)
|
889 |
|
890 |
+
# ์ฑ๋ด ์๋ต์ ๋ฐ๋ฅธ ๊ฒฐ๊ณผ ์
๋ฐ์ดํธ
|
891 |
+
msg.submit(
|
892 |
+
update_protein_display,
|
893 |
+
inputs=[chatbot],
|
894 |
+
outputs=[hero_stats, hero_description, output_seq, output_pdb, output_viewer, plddt_plot]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
895 |
)
|
896 |
|
897 |
+
# ์คํ
|
898 |
demo.queue()
|
899 |
+
demo.launch(debug=True)
|