Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -128,7 +128,7 @@ def show_input(in_fragments, in_protein):
|
|
| 128 |
vis = show_target(in_protein)
|
| 129 |
elif in_fragments is not None and in_protein is not None:
|
| 130 |
vis = show_fragments_and_target(in_fragments, in_protein)
|
| 131 |
-
return [vis, gr.Dropdown
|
| 132 |
|
| 133 |
|
| 134 |
def show_fragments(in_fragments):
|
|
@@ -170,14 +170,14 @@ def clear_fragments_input(in_protein):
|
|
| 170 |
vis = ''
|
| 171 |
if in_protein is not None:
|
| 172 |
vis = show_target(in_protein)
|
| 173 |
-
return [None, vis, gr.Dropdown
|
| 174 |
|
| 175 |
|
| 176 |
def clear_protein_input(in_fragments):
|
| 177 |
vis = ''
|
| 178 |
if in_fragments is not None:
|
| 179 |
vis = show_fragments(in_fragments)
|
| 180 |
-
return [None, vis, gr.Dropdown
|
| 181 |
|
| 182 |
|
| 183 |
def click_on_example(example):
|
|
@@ -347,7 +347,7 @@ def generate_without_pocket(input_file, n_steps, n_atoms, num_samples, selected_
|
|
| 347 |
return [
|
| 348 |
draw_sample(choice, out_files, num_samples),
|
| 349 |
out_files,
|
| 350 |
-
gr.Dropdown
|
| 351 |
choices=out_files[2:],
|
| 352 |
value=choice,
|
| 353 |
visible=True,
|
|
@@ -494,7 +494,7 @@ def generate_with_pocket(in_fragments, in_protein, n_steps, n_atoms, num_samples
|
|
| 494 |
return [
|
| 495 |
draw_sample(choice, out_files, num_samples),
|
| 496 |
out_files,
|
| 497 |
-
gr.Dropdown
|
| 498 |
choices=out_files[3:],
|
| 499 |
value=choice,
|
| 500 |
visible=True,
|
|
@@ -515,56 +515,55 @@ with gr.Blocks(js=output.STARTUP_JS) as demo:
|
|
| 515 |
'[**[Paper]**](https://arxiv.org/abs/2210.05274) '
|
| 516 |
'[**[Code]**](https://github.com/igashov/DiffLinker)'
|
| 517 |
)
|
| 518 |
-
with gr.
|
| 519 |
-
with gr.
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
visualization = gr.HTML()
|
| 568 |
|
| 569 |
input_fragments_file.change(
|
| 570 |
fn=show_input,
|
|
|
|
| 128 |
vis = show_target(in_protein)
|
| 129 |
elif in_fragments is not None and in_protein is not None:
|
| 130 |
vis = show_fragments_and_target(in_fragments, in_protein)
|
| 131 |
+
return [vis, gr.Dropdown(choices=[], value=None, visible=False), None]
|
| 132 |
|
| 133 |
|
| 134 |
def show_fragments(in_fragments):
|
|
|
|
| 170 |
vis = ''
|
| 171 |
if in_protein is not None:
|
| 172 |
vis = show_target(in_protein)
|
| 173 |
+
return [None, vis, gr.Dropdown(choices=[], value=None, visible=False), None]
|
| 174 |
|
| 175 |
|
| 176 |
def clear_protein_input(in_fragments):
|
| 177 |
vis = ''
|
| 178 |
if in_fragments is not None:
|
| 179 |
vis = show_fragments(in_fragments)
|
| 180 |
+
return [None, vis, gr.Dropdown(choices=[], value=None, visible=False), None]
|
| 181 |
|
| 182 |
|
| 183 |
def click_on_example(example):
|
|
|
|
| 347 |
return [
|
| 348 |
draw_sample(choice, out_files, num_samples),
|
| 349 |
out_files,
|
| 350 |
+
gr.Dropdown(
|
| 351 |
choices=out_files[2:],
|
| 352 |
value=choice,
|
| 353 |
visible=True,
|
|
|
|
| 494 |
return [
|
| 495 |
draw_sample(choice, out_files, num_samples),
|
| 496 |
out_files,
|
| 497 |
+
gr.Dropdown(
|
| 498 |
choices=out_files[3:],
|
| 499 |
value=choice,
|
| 500 |
visible=True,
|
|
|
|
| 515 |
'[**[Paper]**](https://arxiv.org/abs/2210.05274) '
|
| 516 |
'[**[Code]**](https://github.com/igashov/DiffLinker)'
|
| 517 |
)
|
| 518 |
+
with gr.Row():
|
| 519 |
+
with gr.Column():
|
| 520 |
+
gr.Markdown('## Input')
|
| 521 |
+
gr.Markdown('Upload the file with 3D-coordinates of the input fragments in .pdb, .mol2 or .sdf format:')
|
| 522 |
+
input_fragments_file = gr.File(file_count='single', label='Input Fragments')
|
| 523 |
+
gr.Markdown('Upload the file of the target protein in .pdb format (optionally):')
|
| 524 |
+
input_protein_file = gr.File(file_count='single', label='Target Protein (Optional)')
|
| 525 |
+
|
| 526 |
+
n_steps = gr.Slider(
|
| 527 |
+
minimum=MIN_N_STEPS, maximum=MAX_N_STEPS,
|
| 528 |
+
label="Number of Denoising Steps", step=10
|
| 529 |
+
)
|
| 530 |
+
n_atoms = gr.Slider(
|
| 531 |
+
minimum=0, maximum=20,
|
| 532 |
+
label="Linker Size: DiffLinker will predict it if set to 0",
|
| 533 |
+
step=1
|
| 534 |
+
)
|
| 535 |
+
n_samples = gr.Slider(minimum=5, maximum=50, label="Number of Samples", step=5)
|
| 536 |
+
examples = gr.Dataset(
|
| 537 |
+
components=[gr.File(visible=False), gr.File(visible=False)],
|
| 538 |
+
samples=[
|
| 539 |
+
['examples/example_1.sdf', ''],
|
| 540 |
+
['examples/example_2.sdf', ''],
|
| 541 |
+
['examples/3hz1_fragments.sdf', 'examples/3hz1_protein.pdb'],
|
| 542 |
+
['examples/5ou2_fragments.sdf', 'examples/5ou2_protein.pdb'],
|
| 543 |
+
],
|
| 544 |
+
type='values',
|
| 545 |
+
headers=['Input Fragments', 'Target Protein'],
|
| 546 |
+
)
|
| 547 |
+
|
| 548 |
+
button = gr.Button('Generate Linker!')
|
| 549 |
+
gr.Markdown('')
|
| 550 |
+
gr.Markdown('## Output Files')
|
| 551 |
+
gr.Markdown('Download files with the generated molecules here:')
|
| 552 |
+
output_files = gr.File(file_count='multiple', label='Output Files', interactive=False)
|
| 553 |
+
hidden = gr.Textbox(visible=False)
|
| 554 |
+
with gr.Column():
|
| 555 |
+
gr.Markdown('## Visualization')
|
| 556 |
+
gr.Markdown('**Hint:** click on atoms to select anchor points (optionally)')
|
| 557 |
+
samples = gr.Dropdown(
|
| 558 |
+
choices=[],
|
| 559 |
+
value=None,
|
| 560 |
+
type='value',
|
| 561 |
+
multiselect=False,
|
| 562 |
+
visible=False,
|
| 563 |
+
interactive=True,
|
| 564 |
+
label='Samples'
|
| 565 |
+
)
|
| 566 |
+
visualization = gr.HTML()
|
|
|
|
| 567 |
|
| 568 |
input_fragments_file.change(
|
| 569 |
fn=show_input,
|