nonstopiodemo commited on
Commit
a5b9df3
Β·
verified Β·
1 Parent(s): 1a4663f

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +6 -6
  2. requirements.txt +3 -0
  3. streamlit_app.py +23 -0
README.md CHANGED
@@ -1,12 +1,12 @@
1
  ---
2
- title: Calculator
3
- emoji: πŸƒ
4
  colorFrom: blue
5
  colorTo: green
6
  sdk: streamlit
7
- sdk_version: 1.38.0
8
- app_file: app.py
9
  pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: calculator
3
+ emoji: πŸš€
4
  colorFrom: blue
5
  colorTo: green
6
  sdk: streamlit
7
+ sdk_version: "1.10.0"
8
+ app_file: streamlit_app.py
9
  pinned: false
10
  ---
11
+ # calculator
12
+ This is a Streamlit app generated and deployed automatically.
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ streamlit
2
+ altair==4.2.0
3
+ vega_datasets
streamlit_app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.title('Calculator')
4
+
5
+ num1 = st.number_input('Enter the first number:')
6
+ num2 = st.number_input('Enter the second number:')
7
+
8
+ operation = st.selectbox('Select operation', ['Add', 'Subtract', 'Multiply', 'Divide'])
9
+
10
+ if st.button('Calculate'):
11
+ if operation == 'Add':
12
+ result = num1 + num2
13
+ elif operation == 'Subtract':
14
+ result = num1 - num2
15
+ elif operation == 'Multiply':
16
+ result = num1 * num2
17
+ elif operation == 'Divide':
18
+ if num2 == 0:
19
+ result = 'Cannot divide by zero!'
20
+ else:
21
+ result = num1 / num2
22
+
23
+ st.write('Result:', result)