Spaces:
Sleeping
Sleeping
Download src/streamlit_app.py from Pratik333/MY_FIRST_SPACE: direct link, hf CLI and curl.
- Browser
- Download file 564 Bytes
-
https://huggingface.co/spaces/Pratik333/MY_FIRST_SPACE/resolve/main/src/streamlit_app.py
- Command line
-
hf download hf://spaces/Pratik333/MY_FIRST_SPACE/src/streamlit_app.py
-
curl -L -o streamlit_app.py https://huggingface.co/spaces/Pratik333/MY_FIRST_SPACE/resolve/main/src/streamlit_app.py
564 Bytes
| import streamlit as st | |
| st.title("Simple Arithmetic App") | |
| # Input values | |
| a = st.number_input("Enter first number", value=0.0) | |
| b = st.number_input("Enter second number", value=0.0) | |
| # Operation selection | |
| operation = st.selectbox("Choose an operation", ["Add", "Subtract", "Multiply", "Divide"]) | |
| # Result | |
| if operation == "Add": | |
| result = a + b | |
| elif operation == "Subtract": | |
| result = a - b | |
| elif operation == "Multiply": | |
| result = a * b | |
| elif operation == "Divide": | |
| result = "Cannot divide by zero" if b == 0 else a / b | |
| st.write("### Result:", result) | |