Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import joblib
|
3 |
import numpy as np
|
4 |
-
import
|
5 |
from sklearn.preprocessing import MinMaxScaler
|
6 |
|
7 |
# Load trained SVM model and scaler (Ensure both files exist in the Space)
|
@@ -11,16 +11,11 @@ scaler = MinMaxScaler()
|
|
11 |
def extract_features(sequence):
|
12 |
"""Calculate AAC, Dipeptide Composition, and normalize features."""
|
13 |
# Calculate Amino Acid Composition (AAC)
|
14 |
-
aac =
|
15 |
-
|
16 |
-
# Calculate Dipeptide Composition
|
17 |
-
dipeptide_comp = propy.AAComposition.CalculateAADipeptideComposition(sequence)
|
18 |
-
|
19 |
-
# Combine both features (AAC and Dipeptide Composition)
|
20 |
-
features = np.concatenate((aac, dipeptide_comp))
|
21 |
|
22 |
# Normalize with pre-trained scaler (avoid fitting new data)
|
23 |
-
normalized_features = scaler.transform([
|
24 |
|
25 |
return normalized_features
|
26 |
|
|
|
1 |
import gradio as gr
|
2 |
import joblib
|
3 |
import numpy as np
|
4 |
+
from propy3 import AAComposition
|
5 |
from sklearn.preprocessing import MinMaxScaler
|
6 |
|
7 |
# Load trained SVM model and scaler (Ensure both files exist in the Space)
|
|
|
11 |
def extract_features(sequence):
|
12 |
"""Calculate AAC, Dipeptide Composition, and normalize features."""
|
13 |
# Calculate Amino Acid Composition (AAC)
|
14 |
+
aac = AAComposition.CalculateAADipeptideComposition(sequence)
|
15 |
+
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
# Normalize with pre-trained scaler (avoid fitting new data)
|
18 |
+
normalized_features = scaler.transform([aac])
|
19 |
|
20 |
return normalized_features
|
21 |
|