File size: 680 Bytes
52ef71c
 
 
 
 
 
 
 
 
 
 
 
 
d927a74
13f26ee
 
 
52ef71c
 
c190385
2d290d9
52ef71c
 
 
5aeaca2
52ef71c
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 greet(num1, operator,num2):

    if operator == 'add':
        return num1 + num2
    elif operator=='subtract':
        return num1 - num2
    elif operator=='multiply':
        return num1 * num2
    elif operator=='divide':
        return num1/num2

examples=[[3,'subtract',2],[8,'multiply',10],[4,'add',5],[23,'divide',5]]
title="test calculator"
description="heres a sample toy calculator. enjoy!"
interpretation="default"

demo = gr.Interface(greet,[gr.Number(4), gr.Radio(["add", "subtract", "multiply", "divide"]), "number"],
    "number",title=title,
    description=description,interpretation=interpretation,
)


demo.launch(enable_queue=True)