Spaces:
Build error
Build error
| import gradio as gr | |
| def calculate(operation, a, b): | |
| if operation == 'Add': | |
| return a + b | |
| elif operation == 'Subtract': | |
| return a - b | |
| elif operation == 'Multiply': | |
| return a * b | |
| elif operation == 'Divide': | |
| return a / b if b != 0 else 'Error: Division by zero' | |
| interface = gr.Interface( | |
| fn=calculate, | |
| inputs=[ | |
| gr.Dropdown(choices=['Add', 'Subtract', 'Multiply', 'Divide'], label="Operation"), | |
| gr.Number(label="First Number"), | |
| gr.Number(label="Second Number") | |
| ], | |
| outputs="text" | |
| ) | |
| interface.launch() | |