Spaces:
Sleeping
Sleeping
File size: 595 Bytes
05282d2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
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()
|