Download app.py from Reddy2909/charan: direct link, hf CLI and curl.
- Browser
- Download file 677 Bytes
-
https://huggingface.co/spaces/Reddy2909/charan/resolve/main/app.py
- Command line
-
hf download hf://spaces/Reddy2909/charan/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Reddy2909/charan/resolve/main/app.py
677 Bytes
| import streamlit as st | |
| # Title of the app | |
| st.title("Simple Calculator") | |
| # Input numbers | |
| num1 = st.number_input("Enter first number", value=0.0) | |
| num2 = st.number_input("Enter second number", value=0.0) | |
| # Operation selection | |
| operation = st.selectbox("Select operation", ["Add", "Subtract", "Multiply", "Divide"]) | |
| # Perform the calculation | |
| if operation == "Add": | |
| result = num1 + num2 | |
| elif operation == "Subtract": | |
| result = num1 - num2 | |
| elif operation == "Multiply": | |
| result = num1 * num2 | |
| elif operation == "Divide": | |
| if num2 != 0: | |
| result = num1 / num2 | |
| else: | |
| result = "Error! Division by zero." | |
| # Display the result | |
| st.write("Result:", result) |