Spaces:
Sleeping
Sleeping
Download api.py from jacksonwambali/Bert: direct link, hf CLI and curl.
- Browser
- Download file 447 Bytes
-
https://huggingface.co/spaces/jacksonwambali/Bert/resolve/main/api.py
- Command line
-
hf download hf://spaces/jacksonwambali/Bert/api.py
-
curl -L -o api.py https://huggingface.co/spaces/jacksonwambali/Bert/resolve/main/api.py
447 Bytes
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| from app import GradioScamDetector | |
| app = FastAPI() | |
| detector = GradioScamDetector() | |
| class PredictRequest(BaseModel): | |
| data: list[str] | |
| async def predict(request: PredictRequest): | |
| message = request.data[0] | |
| result_text, confidence, _, _ = detector.predict_message(message) | |
| return { | |
| "result": result_text, | |
| "confidence": confidence | |
| } | |