Spaces:
Sleeping
Sleeping
File size: 1,860 Bytes
8d34c11 0e58639 8d34c11 9005dd0 8d34c11 9005dd0 8d34c11 9005dd0 0e58639 8d34c11 9005dd0 5ebb00f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
---
title: Calculator App
emoji: 🔢
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.19.2
app_file: app.py
pinned: false
---
# Calculator Application
A simple calculator application built with Gradio and FastAPI.
## Features
- Addition
- Subtraction
- Multiplication
- Division
- Clean and intuitive user interface
- Error handling for invalid operations
## How to Use
1. Enter two numbers in the input fields
2. Select the operation you want to perform
3. Click the "Calculate" button
4. View the result in the output field
## Tech Stack
- Frontend: Gradio 4.19.2
- Backend: FastAPI
- Data Validation: Pydantic
## Setup
1. Clone the repository:
```bash
git clone https://github.com/NikhilSetiya/calculator-app.git
cd calculator-app
```
2. Create and activate a virtual environment:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
3. Install dependencies:
```bash
pip install -r requirements.txt
```
4. Start the backend server:
```bash
python backend.py
```
5. In a new terminal, start the frontend:
```bash
python frontend.py
```
6. Open your web browser and navigate to the URL shown in the Gradio output (typically http://localhost:7860)
## API Documentation
Once the backend server is running, you can access the API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
## Usage
1. Enter two numbers in the input fields
2. Select the operation you want to perform
3. Click the "Calculate" button
4. View the result in the output field
## Error Handling
The application handles various error cases:
- Division by zero
- Invalid operations
- Network errors
- Input validation
## Contributing
Feel free to submit issues and enhancement requests!
## License
This project is licensed under the MIT License - see the LICENSE file for details.
|