Commit 1: Add 50 file(s)
Browse files- demos/calculator/run.py +2 -11
demos/calculator/run.py
CHANGED
@@ -1,15 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def calculator(num1
|
4 |
-
"""
|
5 |
-
Calculator function.
|
6 |
-
Args:
|
7 |
-
num1: The first number to calculate.
|
8 |
-
operation: The operation to perform.
|
9 |
-
num2: The second number to calculate.
|
10 |
-
Returns:
|
11 |
-
The result of the calculation.
|
12 |
-
"""
|
13 |
if operation == "add":
|
14 |
return num1 + num2
|
15 |
elif operation == "subtract":
|
@@ -40,4 +31,4 @@ demo = gr.Interface(
|
|
40 |
)
|
41 |
|
42 |
if __name__ == "__main__":
|
43 |
-
demo.launch(
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
def calculator(num1, operation, num2):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
if operation == "add":
|
5 |
return num1 + num2
|
6 |
elif operation == "subtract":
|
|
|
31 |
)
|
32 |
|
33 |
if __name__ == "__main__":
|
34 |
+
demo.launch()
|