wnagleiofficial commited on
Commit
b4a5044
·
1 Parent(s): 4754bea

add annotation

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import torch
2
- from NeuroPredPLM.predict import predict, batch_predict
3
  import gradio as gr
4
  from io import StringIO
5
  from Bio import SeqIO
@@ -10,7 +10,7 @@ def classifier(peptide_seq):
10
  for record in SeqIO.parse(handle, 'fasta'):
11
  data.append((record.id, str(record.seq)))
12
  device = "cuda" if torch.cuda.is_available() else "cpu"
13
- neuropeptide_pred = predict(data, './model.pth', device)
14
  return neuropeptide_pred
15
  # {peptide_id:[Type:int(1->neuropeptide,0->non-neuropeptide), attention score:nd.array]}
16
 
@@ -20,7 +20,7 @@ def batch_classifier(file, cutoff):
20
  for record in SeqIO.parse(file.name, 'fasta'):
21
  data.append((record.id, str(record.seq)))
22
  device = "cuda" if torch.cuda.is_available() else "cpu"
23
- neuropeptide_pred = batch_predict(data, cutoff, './model.pth', device)
24
  return neuropeptide_pred
25
 
26
  with gr.Blocks() as demo:
@@ -39,6 +39,7 @@ with gr.Blocks() as demo:
39
  single_cutoff = gr.Slider(0, 1, step=0.1, value=0.5, interactive=True, label="Threshold")
40
  text_button = gr.Button("Submit")
41
  with gr.Column(scale=2):
 
42
  text_output = gr.outputs.Label(num_top_classes=2, label='Output')
43
  with gr.Tab("Batch Model"):
44
  with gr.Row():
@@ -55,6 +56,7 @@ with gr.Blocks() as demo:
55
  image_button = gr.Button("Submit")
56
  with gr.Column():
57
  # gr.Markdown(" ### Flip text or image files using this demo.")
 
58
  frame_output = gr.DataFrame(headers=["Sequence Id", "Sequence", "Probability of neuropeptides", "Neuropeptide"],
59
  datatype=["str", "str", "str", 'str'],)
60
 
 
1
  import torch
2
+ from NeuroPredPLM.predict import predict, batch_predict, batch_predict_beta
3
  import gradio as gr
4
  from io import StringIO
5
  from Bio import SeqIO
 
10
  for record in SeqIO.parse(handle, 'fasta'):
11
  data.append((record.id, str(record.seq)))
12
  device = "cuda" if torch.cuda.is_available() else "cpu"
13
+ neuropeptide_pred = predict(data, '/mnt/d/protein-net/NeuroPred-PLM/NeuroPred-PLM/model.pth', device)
14
  return neuropeptide_pred
15
  # {peptide_id:[Type:int(1->neuropeptide,0->non-neuropeptide), attention score:nd.array]}
16
 
 
20
  for record in SeqIO.parse(file.name, 'fasta'):
21
  data.append((record.id, str(record.seq)))
22
  device = "cuda" if torch.cuda.is_available() else "cpu"
23
+ neuropeptide_pred = batch_predict_beta(data, cutoff, '/mnt/d/protein-net/NeuroPred-PLM/NeuroPred-PLM/model.pth', device)
24
  return neuropeptide_pred
25
 
26
  with gr.Blocks() as demo:
 
39
  single_cutoff = gr.Slider(0, 1, step=0.1, value=0.5, interactive=True, label="Threshold")
40
  text_button = gr.Button("Submit")
41
  with gr.Column(scale=2):
42
+ gr.Markdown("#### The larger the probability score of neuropeptide output, the more likely it is to belong to neuropeptide. Generally, result greater than the threshold (default:0.5) is considered to belong to neuropeptides.")
43
  text_output = gr.outputs.Label(num_top_classes=2, label='Output')
44
  with gr.Tab("Batch Model"):
45
  with gr.Row():
 
56
  image_button = gr.Button("Submit")
57
  with gr.Column():
58
  # gr.Markdown(" ### Flip text or image files using this demo.")
59
+ gr.Markdown("#### The larger the probability score of neuropeptide output, the more likely it is to belong to neuropeptide. Generally, result greater than the threshold (default:0.5) is considered to belong to neuropeptides.")
60
  frame_output = gr.DataFrame(headers=["Sequence Id", "Sequence", "Probability of neuropeptides", "Neuropeptide"],
61
  datatype=["str", "str", "str", 'str'],)
62