import gradio as gr def calculator(num1, operation, num2): if operation == "+": return num1 + num2 elif operation == "-": return num1 - num2 elif operation == "*": return num1 * num2 elif operation == "/": return num1 / num2 if num2 != 0 else "Error: Division by zero" else: return "Error: Invalid operation" iface = gr.Interface( fn=calculator, inputs=[ gr.Number(label="First Number"), gr.Radio(["+", "-", "*", "/"], label="Operation"), gr.Number(label="Second Number") ], outputs=gr.Number(label="Result"), title="Simple Calculator", description="Enter two numbers and choose an operation to perform basic arithmetic.", examples=[ [5, "+", 3], [10, "-", 4], [6, "*", 7], [15, "/", 3] ] ) iface.launch()