wangjin2000 commited on
Commit
5788782
·
verified ·
1 Parent(s): 8431bfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -13
app.py CHANGED
@@ -277,6 +277,7 @@ MODEL_OPTIONS = [
277
 
278
  PEFT_MODEL_OPTIONS = [
279
  "AmelieSchreiber/esm2_t12_35M_lora_binding_sites_v2_cp3",
 
280
  ] # finetuned models
281
 
282
 
@@ -372,7 +373,7 @@ with demo:
372
  gr.Markdown("# DEMO FOR ESM2Bind")
373
  #gr.Textbox(dubug_result)
374
 
375
- gr.Markdown("## Finetune Pre-trained Model")
376
  with gr.Column():
377
  gr.Markdown("## Select a base model")
378
  gr.Markdown(
@@ -392,7 +393,7 @@ with demo:
392
  label="PEFT Model Name",
393
  interactive = True,
394
  )
395
- with gr.Column(variant="compact"):
396
  name = gr.Dropdown(
397
  label="Choose a Sample Protein",
398
  value="Default protein",
@@ -411,20 +412,27 @@ with demo:
411
  placeholder="Paste your protein sequence here...",
412
  interactive = True,
413
  )
414
- with gr.Column(variant="compact", scale = 2):
415
- finetune_button = gr.Button(
416
- value="Finetune Pre-trained Model",
417
  interactive=True,
418
  variant="primary",
419
  )
420
  plot_struc_btn = gr.Button(value = "Plot ESMFold Predicted Structure ", variant="primary")
421
  with gr.Row():
422
- finetune_output_text = gr.Textbox(
423
- lines=1,
424
- max_lines=12,
425
- label="Finetune Status",
426
- placeholder="Finetune Status Shown Here",
427
- )
 
 
 
 
 
 
 
428
  with gr.Row():
429
  output_viewer = gr.HTML()
430
  output_file = gr.File(
@@ -437,14 +445,21 @@ with demo:
437
  # select protein sample
438
  name.change(fn=suggest, inputs=name, outputs=input_seq)
439
 
 
 
 
 
 
 
440
  # "Finetune Pre-trained Model" actions
441
  finetune_button.click(
442
  fn = train_function_no_sweeps,
443
- inputs=[base_model_name], #finetune_dataset_name],
444
- outputs = [finetune_output_text],
445
  )
446
 
447
  # plot protein structure
448
  plot_struc_btn.click(fn=plot_struc, inputs=input_seq, outputs=[output_file, output_viewer])
 
449
 
450
  demo.launch()
 
277
 
278
  PEFT_MODEL_OPTIONS = [
279
  "AmelieSchreiber/esm2_t12_35M_lora_binding_sites_v2_cp3",
280
+ "wangjin2000/esm2_t6_8M-lora-binding-sites_2024-07-02_09-26-54",
281
  ] # finetuned models
282
 
283
 
 
373
  gr.Markdown("# DEMO FOR ESM2Bind")
374
  #gr.Textbox(dubug_result)
375
 
376
+ #gr.Markdown("## Finetune Pre-trained Model")
377
  with gr.Column():
378
  gr.Markdown("## Select a base model")
379
  gr.Markdown(
 
393
  label="PEFT Model Name",
394
  interactive = True,
395
  )
396
+ with gr.Column(scale=0.5, variant="compact"):
397
  name = gr.Dropdown(
398
  label="Choose a Sample Protein",
399
  value="Default protein",
 
412
  placeholder="Paste your protein sequence here...",
413
  interactive = True,
414
  )
415
+ with gr.Column(variant="compact", scale = 2):
416
+ predict_btn = gr.Button(
417
+ value="Predict binding site",
418
  interactive=True,
419
  variant="primary",
420
  )
421
  plot_struc_btn = gr.Button(value = "Plot ESMFold Predicted Structure ", variant="primary")
422
  with gr.Row():
423
+ with gr.Column(variant="compact", scale = 5):
424
+ output_text = gr.Textbox(
425
+ lines=1,
426
+ max_lines=12,
427
+ label="Output",
428
+ placeholder="Output",
429
+ )
430
+ with gr.Column(variant="compact", scale = 5):
431
+ finetune_button = gr.Button(
432
+ value="Finetune Pre-trained Model",
433
+ interactive=True,
434
+ variant="primary",
435
+ )
436
  with gr.Row():
437
  output_viewer = gr.HTML()
438
  output_file = gr.File(
 
445
  # select protein sample
446
  name.change(fn=suggest, inputs=name, outputs=input_seq)
447
 
448
+ # "Predict binding site" actions
449
+ predict_btn.click(
450
+ fn = predict_bind,
451
+ inputs=[base_model_name,PEFT_model_name,input_seq],
452
+ outputs = [output_text],
453
+ )
454
  # "Finetune Pre-trained Model" actions
455
  finetune_button.click(
456
  fn = train_function_no_sweeps,
457
+ inputs=[base_model_name],
458
+ outputs = [output_text],
459
  )
460
 
461
  # plot protein structure
462
  plot_struc_btn.click(fn=plot_struc, inputs=input_seq, outputs=[output_file, output_viewer])
463
+
464
 
465
  demo.launch()