aliabd HF staff commited on
Commit
0855ce3
1 Parent(s): 008d5c9

Create app.py

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