Spaces:
Runtime error
Runtime error
Download app/main.py from hudsonma/simpleApplicationDocker: direct link, hf CLI and curl.
- Browser
- Download file 511 Bytes
-
https://huggingface.co/spaces/hudsonma/simpleApplicationDocker/resolve/main/app/main.py
- Command line
-
hf download hf://spaces/hudsonma/simpleApplicationDocker/app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/hudsonma/simpleApplicationDocker/resolve/main/app/main.py
511 Bytes
| from fastapi import FastAPI, HTTPException | |
| from app.model.model import predict_language, __version__ | |
| from app.schemas import Prediction, TextIn | |
| app = FastAPI() | |
| def home(): | |
| return {"message": "Ok", "model_version": __version__} | |
| def predict(payload: TextIn): | |
| try: | |
| language = predict_language(payload.text) | |
| return {"language": language} | |
| except Exception as e: | |
| raise HTTPException(status_code=400, detail=str(e)) | |