Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
import onnxruntime as ort
|
| 3 |
+
from huggingface_hub import hf_hub_download
|
| 4 |
+
|
| 5 |
+
app = FastAPI()
|
| 6 |
+
|
| 7 |
+
# تحميل النموذج عند بدء التشغيل
|
| 8 |
+
MODEL_PATH = hf_hub_download(repo_id="immich-app/antelopev2", filename="model.onnx")
|
| 9 |
+
ort_session = ort.InferenceSession(MODEL_PATH)
|
| 10 |
+
|
| 11 |
+
@app.get("/")
|
| 12 |
+
def read_root():
|
| 13 |
+
return {"message": "Antelope v2 Model is running!"}
|
| 14 |
+
|
| 15 |
+
@app.post("/predict")
|
| 16 |
+
def predict(data: dict):
|
| 17 |
+
# استبدل هذا بالمنطق الفعلي لتشغيل النموذج
|
| 18 |
+
return {"prediction": "dummy result"}
|