tt / app.py
decodingdatascience's picture
Create app.py
05282d2
raw
history blame contribute delete
595 Bytes
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()