calculator / streamlit_app.py
nonstopiodemo's picture
Upload folder using huggingface_hub
a5b9df3 verified
raw
history blame contribute delete
627 Bytes
import streamlit as st
st.title('Calculator')
num1 = st.number_input('Enter the first number:')
num2 = st.number_input('Enter the second number:')
operation = st.selectbox('Select operation', ['Add', 'Subtract', 'Multiply', 'Divide'])
if st.button('Calculate'):
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 = 'Cannot divide by zero!'
else:
result = num1 / num2
st.write('Result:', result)