"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

May 21, 2021

Streamlit calculator demo

 


import streamlit as st
import inspect
import streamlit as st
import streamlit as st
import numpy as np
st.title("Streamlit Calculator")
st.markdown('**Calculator Demo:**')
number1 = st.number_input("Enter number one",1)
number2 = st.number_input("Enter number two",1)
operation = st.radio("Select : ", ('Add', 'Multiply'))
scenariosubmit = st.button('Run Demo')
result = 0
if scenariosubmit:
if operation == 'Add':
result = number1 + number2
if operation == 'Multiply':
result = number1 * number2
st.markdown('**Results:**')
st.write(result)
view raw calcdemo.py hosted with ❤ by GitHub


Keep Adding more relevant examples!!!


No comments: