Spaces:
Sleeping
Sleeping
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() |