calculator / app.py
JohnTan38's picture
Update app.py
3eead75
raw
history blame
No virus
628 Bytes
import gradio as gr
def calculator(num1, operation, num2):
if operation == "thêm vào":
return num1 + num2
elif operation == "trừ đi":
return num1 - num2
elif operation == "nhân":
return num1 * num2
elif operation == "chia":
return num1 / num2
demo = gr.Interface(
fn=calculator,
inputs=[
gr.Number(value=2),
gr.Radio(["thêm vào", "trừ đi","nhân","chia"]),
"number"
],
outputs="number",
examples=[
],
title="Mạnh Cường cậu bé thông minh",
description="Máy tính. thêm vào. trừ. nhân"
)
demo.launch(debug=True)