Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -47,10 +47,10 @@ def extract_features(sequence):
|
|
47 |
selected_feature_values = [all_features[feature] for feature in selected_features if feature in all_features]
|
48 |
|
49 |
# Convert to NumPy array for normalization
|
50 |
-
feature_array = np.array(selected_feature_values)
|
51 |
# Min-Max Normalization
|
52 |
scaler = MinMaxScaler()
|
53 |
-
normalized_features = scaler.fit_transform(feature_array)
|
54 |
|
55 |
return normalized_features
|
56 |
|
@@ -58,7 +58,7 @@ def extract_features(sequence):
|
|
58 |
def predict(sequence):
|
59 |
"""Predict AMP vs Non-AMP"""
|
60 |
features = extract_features(sequence)
|
61 |
-
prediction = model.predict(features)[0]
|
62 |
return "AMP" if prediction == 0 else "Non-AMP"
|
63 |
|
64 |
# Create Gradio interface
|
@@ -71,4 +71,4 @@ iface = gr.Interface(
|
|
71 |
)
|
72 |
|
73 |
# Launch app
|
74 |
-
iface.launch(share=True)
|
|
|
47 |
selected_feature_values = [all_features[feature] for feature in selected_features if feature in all_features]
|
48 |
|
49 |
# Convert to NumPy array for normalization
|
50 |
+
feature_array = np.array(selected_feature_values).reshape(-1, 1)
|
51 |
# Min-Max Normalization
|
52 |
scaler = MinMaxScaler()
|
53 |
+
normalized_features = scaler.fit_transform(feature_array)
|
54 |
|
55 |
return normalized_features
|
56 |
|
|
|
58 |
def predict(sequence):
|
59 |
"""Predict AMP vs Non-AMP"""
|
60 |
features = extract_features(sequence)
|
61 |
+
prediction = model.predict(features.T)[0]
|
62 |
return "AMP" if prediction == 0 else "Non-AMP"
|
63 |
|
64 |
# Create Gradio interface
|
|
|
71 |
)
|
72 |
|
73 |
# Launch app
|
74 |
+
iface.launch(share=True)
|