bhavikjikadara commited on
Commit
9de50ce
1 Parent(s): 8ba9026

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def calculator(num1, num2, operation):
4
+ if operation == "add":
5
+ return num1 + num2
6
+ elif operation == "subtract":
7
+ return num1 - num2
8
+ elif operation == "multiply":
9
+ return num1 * num2
10
+ elif operation == "divide":
11
+ return num1 / num2
12
+
13
+ demo = gr.Interface(
14
+ fn = calculator,
15
+ inputs = [
16
+ "number",
17
+ "number",
18
+ gr.Radio(["add", "subtract", "multiply", "divide"])
19
+ ],
20
+ outputs="number",
21
+ live=True,
22
+ )
23
+ demo.launch()