calculator / app.py
sonalisuhane's picture
Update app.py
c190385
raw
history blame contribute delete
No virus
680 Bytes
import gradio as gr
def greet(num1, operator,num2):
if operator == 'add':
return num1 + num2
elif operator=='subtract':
return num1 - num2
elif operator=='multiply':
return num1 * num2
elif operator=='divide':
return num1/num2
examples=[[3,'subtract',2],[8,'multiply',10],[4,'add',5],[23,'divide',5]]
title="test calculator"
description="heres a sample toy calculator. enjoy!"
interpretation="default"
demo = gr.Interface(greet,[gr.Number(4), gr.Radio(["add", "subtract", "multiply", "divide"]), "number"],
"number",title=title,
description=description,interpretation=interpretation,
)
demo.launch(enable_queue=True)