Usually3 commited on
Commit
564b4e2
·
1 Parent(s): c17cc79

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
 
 
3
  def calculator(num1, operation, num2):
4
  if operation == "add":
5
  return num1 + num2
@@ -19,13 +20,14 @@ def calculator(num1, operation, num2):
19
  return math.cos(num1)
20
  elif operation == "tan":
21
  return math.tan(num1)
22
-
 
23
 
24
  demo = gr.Interface(
25
  fn=calculator,
26
  inputs=[
27
  gr.Number(value=4),
28
- gr.Radio(["add", "subtract", "multiply", "divide","square","cube","sin","cos","tan"]),
29
  "number"
30
  ],
31
  outputs="number",
@@ -39,4 +41,4 @@ demo = gr.Interface(
39
  description="Here's a sample scientific calculator. Enjoy! Code by: Freddy Aboulton Improved by: Usually3"
40
  )
41
 
42
- demo.launch()
 
1
  import gradio as gr
2
 
3
+
4
  def calculator(num1, operation, num2):
5
  if operation == "add":
6
  return num1 + num2
 
20
  return math.cos(num1)
21
  elif operation == "tan":
22
  return math.tan(num1)
23
+ else:
24
+ return None
25
 
26
  demo = gr.Interface(
27
  fn=calculator,
28
  inputs=[
29
  gr.Number(value=4),
30
+ gr.Radio(["add", "subtract", "multiply", "divide", "square", "cube", "sin", "cos", "tan"]),
31
  "number"
32
  ],
33
  outputs="number",
 
41
  description="Here's a sample scientific calculator. Enjoy! Code by: Freddy Aboulton Improved by: Usually3"
42
  )
43
 
44
+ demo.launch()