Spaces:
Build error
Build error
Download calculator.py from SaintlyPioneer/FastAPI_Calculator: direct link, hf CLI and curl.
- Browser
- Download file 422 Bytes
-
https://huggingface.co/spaces/SaintlyPioneer/FastAPI_Calculator/resolve/main/calculator.py
- Command line
-
hf download hf://spaces/SaintlyPioneer/FastAPI_Calculator/calculator.py
-
curl -L -o calculator.py https://huggingface.co/spaces/SaintlyPioneer/FastAPI_Calculator/resolve/main/calculator.py
422 Bytes
| from pydantic import BaseModel | |
| class Calculator(BaseModel): | |
| num1: float | |
| num2: float | |
| def add(self): | |
| return self.num1+self.num2 | |
| def subtract(self): | |
| return self.num1-self.num2 | |
| def multiply(self): | |
| return self.num1*self.num2 | |
| def divide(self): | |
| if (self.num2 == 0): | |
| raise ValueError("Cannot divide by zero"); | |
| return self.num1/self.num2 | |