AbdelrahmanRagab commited on
Commit
94f7405
1 Parent(s): 6c9ca93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -5
app.py CHANGED
@@ -1,8 +1,26 @@
1
- # app.py
2
  import gradio as gr
3
 
4
- def greet(name):
5
- return f"Hello, {name}!"
6
 
7
- interface = gr.Interface(fn=greet, inputs="text", outputs="text", title="Simple Greeting App", description="Enter your name to get a greeting.")
8
- interface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ def sum_numbers(a, b):
4
+ return a + b
5
 
6
+ def multiply_numbers(a, b):
7
+ return a * b
8
+
9
+ with gr.Blocks() as demo:
10
+ gr.Markdown("Perform sum and multiplication using this demo.")
11
+ with gr.Tab("Sum"):
12
+ num1_input = gr.Number(label="First Number")
13
+ num2_input = gr.Number(label="Second Number")
14
+ sum_output = gr.Textbox()
15
+ sum_button = gr.Button("Calculate Sum")
16
+ with gr.Tab("Multiplication"):
17
+ num1_input_mult = gr.Number(label="First Number")
18
+ num2_input_mult = gr.Number(label="Second Number")
19
+ multiply_output = gr.Textbox()
20
+ multiply_button = gr.Button("Calculate Multiplication")
21
+
22
+ sum_button.click(sum_numbers, inputs=[num1_input, num2_input], outputs=sum_output)
23
+ multiply_button.click(multiply_numbers, inputs=[num1_input_mult, num2_input_mult], outputs=multiply_output)
24
+
25
+ if __name__ == "__main__":
26
+ demo.launch()