Spaces:
Running
Running
Upload 3 files
Browse files- SVM.joblib +3 -0
- app.py +20 -0
- requirements.txt +7 -0
SVM.joblib
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7880a1538dd9a9e3d2e149235dd956fb1a53c2a54bc81c051699de599adff943
|
3 |
+
size 4475227
|
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
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 |
+
@app.get("/")
|
11 |
+
def home():
|
12 |
+
return {"message": "AMP Classifier API is running!"}
|
13 |
+
|
14 |
+
@app.post("/predict")
|
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])}
|
requirements.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
fastapi
|
2 |
+
uvicorn
|
3 |
+
scikit-learn
|
4 |
+
joblib
|
5 |
+
numpy
|
6 |
+
pandas
|
7 |
+
gradio
|