Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,13 @@
|
|
1 |
-
|
2 |
import joblib
|
3 |
-
import numpy as np
|
4 |
-
|
5 |
-
app = FastAPI()
|
6 |
|
7 |
# Load your trained model
|
8 |
model = joblib.load("SVM.joblib") # Ensure this file is in the correct directory
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
return
|
|
|
|
|
13 |
|
14 |
-
|
15 |
-
def predict(sequence: str):
|
16 |
-
# Convert sequence to features (modify if needed)
|
17 |
-
features = np.array([len(sequence)]) # Example: length of sequence
|
18 |
-
prediction = model.predict([features])
|
19 |
-
|
20 |
-
return {"sequence": sequence, "is_AMP": bool(prediction[0])}
|
|
|
1 |
+
import gradio as gr
|
2 |
import joblib
|
|
|
|
|
|
|
3 |
|
4 |
# Load your trained model
|
5 |
model = joblib.load("SVM.joblib") # Ensure this file is in the correct directory
|
6 |
|
7 |
+
def predict(sequence):
|
8 |
+
prediction = model.predict([len(sequence)]) # Adjust based on your features
|
9 |
+
return "AMP" if prediction[0] else "Non-AMP"
|
10 |
+
|
11 |
+
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
12 |
|
13 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|