Spaces:
Runtime error
Runtime error
Create app.py
Browse files
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 |
+
iface = gr.Interface(
|
15 |
+
calculator,
|
16 |
+
["number", gr.inputs.Radio(["add", "subtract", "multiply", "divide"]), "number"],
|
17 |
+
"number",
|
18 |
+
allow_flagging="manual",
|
19 |
+
flagging_options=["wrong sign", "off by one", "other"]
|
20 |
+
)
|
21 |
+
|
22 |
+
iface.launch()
|