Calculator / app.py
bhavikjikadara's picture
Create app.py
9de50ce verified
raw
history blame contribute delete
No virus
508 Bytes
import gradio as gr
def calculator(num1, num2, operation):
if operation == "add":
return num1 + num2
elif operation == "subtract":
return num1 - num2
elif operation == "multiply":
return num1 * num2
elif operation == "divide":
return num1 / num2
demo = gr.Interface(
fn = calculator,
inputs = [
"number",
"number",
gr.Radio(["add", "subtract", "multiply", "divide"])
],
outputs="number",
live=True,
)
demo.launch()