Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# 1. Define the function
|
| 4 |
+
def add(num1, num2):
|
| 5 |
+
"""This function adds two numbers and returns the sum."""
|
| 6 |
+
return num1 + num2
|
| 7 |
+
|
| 8 |
+
# 2. Create the Gradio Interface
|
| 9 |
+
iface = gr.Interface(
|
| 10 |
+
fn=add,
|
| 11 |
+
inputs=[gr.Number(label="First Number"), gr.Number(label="Second Number")],
|
| 12 |
+
outputs=gr.Number(label="Sum"),
|
| 13 |
+
title="Simple Adder ➕",
|
| 14 |
+
description="Enter two numbers and click 'Submit' to see their sum."
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
# 3. Launch the Interface
|
| 18 |
+
iface.launch()
|