Update app.py
Browse files
app.py
CHANGED
@@ -41,16 +41,16 @@ def get_embeddings(seq):
|
|
41 |
|
42 |
return emb_0_per_protein
|
43 |
|
44 |
-
def predict(
|
45 |
-
sequences = SeqIO.parse(
|
46 |
|
47 |
ids = []
|
48 |
num_sequences=sum(1 for seq in sequences)
|
49 |
embeds = np.zeros((num_sequences, 1024))
|
50 |
i = 0
|
51 |
-
with open(
|
52 |
# Iterate over each sequence in the file
|
53 |
-
for sequence in SeqIO.parse(
|
54 |
# Access the sequence ID and sequence data
|
55 |
seq_id = sequence.id
|
56 |
seq_data = str(sequence.seq)
|
@@ -116,7 +116,8 @@ def predict(filepath):
|
|
116 |
|
117 |
gr.Interface(
|
118 |
predict,
|
119 |
-
title = 'Protein Function Prediction
|
120 |
inputs="file",
|
121 |
-
outputs="file"
|
|
|
122 |
).launch()
|
|
|
41 |
|
42 |
return emb_0_per_protein
|
43 |
|
44 |
+
def predict(fasta_file):
|
45 |
+
sequences = SeqIO.parse(fasta_file, "fasta")
|
46 |
|
47 |
ids = []
|
48 |
num_sequences=sum(1 for seq in sequences)
|
49 |
embeds = np.zeros((num_sequences, 1024))
|
50 |
i = 0
|
51 |
+
with open(fasta_file, "r") as fastafile:
|
52 |
# Iterate over each sequence in the file
|
53 |
+
for sequence in SeqIO.parse(fastafile, "fasta"):
|
54 |
# Access the sequence ID and sequence data
|
55 |
seq_id = sequence.id
|
56 |
seq_data = str(sequence.seq)
|
|
|
116 |
|
117 |
gr.Interface(
|
118 |
predict,
|
119 |
+
title = 'Multi-label Protein Function Prediction',
|
120 |
inputs="file",
|
121 |
+
outputs="file",
|
122 |
+
description="Upload a fasta file containing protein sequence"
|
123 |
).launch()
|