Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,36 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# Create a layout for the calculator
|
| 4 |
layout = gr.GridLayout(cols=3, rows=4)
|
| 5 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
# Create a row for the first number
|
| 4 |
+
row1 = gr.Row(children=[
|
| 5 |
+
gr.Label('Number 1:'),
|
| 6 |
+
gr.Entry(),
|
| 7 |
+
])
|
| 8 |
+
|
| 9 |
+
# Create a row for the second number
|
| 10 |
+
row2 = gr.Row(children=[
|
| 11 |
+
gr.Label('Number 2:'),
|
| 12 |
+
gr.Entry(),
|
| 13 |
+
])
|
| 14 |
+
|
| 15 |
+
# Create a row for the operator
|
| 16 |
+
row3 = gr.Row(children=[
|
| 17 |
+
gr.Label('Operator:'),
|
| 18 |
+
gr.Choice(options=['+', '-', '*', '/'])
|
| 19 |
+
])
|
| 20 |
+
|
| 21 |
+
# Create a row for the result
|
| 22 |
+
row4 = gr.Row(children=[
|
| 23 |
+
gr.Label('Result:')
|
| 24 |
+
])
|
| 25 |
+
|
| 26 |
+
# Create a column to hold the rows
|
| 27 |
+
column = gr.Column(children=[row1, row2, row3, row4])
|
| 28 |
+
|
| 29 |
+
# Create a widget to hold the column
|
| 30 |
+
widget = gr.Widget(column)
|
| 31 |
+
|
| 32 |
+
# Run the GUI event loop
|
| 33 |
+
gradio.run(widget)
|
| 34 |
# Create a layout for the calculator
|
| 35 |
layout = gr.GridLayout(cols=3, rows=4)
|
| 36 |
|