Spaces:
Sleeping
Sleeping
ProtonDataLabs
commited on
Create streamlit_app.py
Browse files- streamlit_app.py +19 -0
streamlit_app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from calculator import add, subtract, multiply, divide
|
3 |
+
|
4 |
+
st.title("Calculator App")
|
5 |
+
|
6 |
+
operation = st.selectbox("Select operation:", ["Add", "Subtract", "Multiply", "Divide"])
|
7 |
+
x = st.number_input("Enter first number:", value=0)
|
8 |
+
y = st.number_input("Enter second number:", value=0)
|
9 |
+
|
10 |
+
if st.button("Calculate"):
|
11 |
+
if operation == "Add":
|
12 |
+
result = add(x, y)
|
13 |
+
elif operation == "Subtract":
|
14 |
+
result = subtract(x, y)
|
15 |
+
elif operation == "Multiply":
|
16 |
+
result = multiply(x, y)
|
17 |
+
elif operation == "Divide":
|
18 |
+
result = divide(x, y)
|
19 |
+
st.write(f"The result is: {result}")
|