Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,4 +51,29 @@ def create_interface():
|
|
| 51 |
for i in range(10):
|
| 52 |
gr.Button(str(i)).click(lambda x=i: update_input(x), inputs=[], outputs=current)
|
| 53 |
gr.Button("Back").click(backspace, inputs=[], outputs=current)
|
| 54 |
-
gr.Button("Clear").click(clear_input
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
for i in range(10):
|
| 52 |
gr.Button(str(i)).click(lambda x=i: update_input(x), inputs=[], outputs=current)
|
| 53 |
gr.Button("Back").click(backspace, inputs=[], outputs=current)
|
| 54 |
+
gr.Button("Clear").click(clear_input, inputs=[], outputs=current)
|
| 55 |
+
|
| 56 |
+
with gr.Row():
|
| 57 |
+
gr.Button("Set A").click(lambda x: float(current_input), inputs=[], outputs=a)
|
| 58 |
+
gr.Button("Set B").click(lambda x: float(current_input), inputs=[], outputs=b)
|
| 59 |
+
|
| 60 |
+
with gr.Row():
|
| 61 |
+
gr.Button("Add").click(lambda a, b: gradio_calculate(a, b, "add"), inputs=[a, b], outputs=result)
|
| 62 |
+
gr.Button("Subtract").click(lambda a, b: gradio_calculate(a, b, "subtract"), inputs=[a, b], outputs=result)
|
| 63 |
+
gr.Button("Multiply").click(lambda a, b: gradio_calculate(a, b, "multiply"), inputs=[a, b], outputs=result)
|
| 64 |
+
gr.Button("Divide").click(lambda a, b: gradio_calculate(a, b, "divide"), inputs=[a, b], outputs=result)
|
| 65 |
+
|
| 66 |
+
with gr.Row():
|
| 67 |
+
gr.Button("Test FastAPI Add").click(lambda a, b: test_fastapi(a, b, "add"), inputs=[a, b], outputs=result)
|
| 68 |
+
gr.Button("Test FastAPI Subtract").click(lambda a, b: test_fastapi(a, b, "subtract"), inputs=[a, b], outputs=result)
|
| 69 |
+
gr.Button("Test FastAPI Multiply").click(lambda a, b: test_fastapi(a, b, "multiply"), inputs=[a, b], outputs=result)
|
| 70 |
+
gr.Button("Test FastAPI Divide").click(lambda a, b: test_fastapi(a, b, "divide"), inputs=[a, b], outputs=result)
|
| 71 |
+
|
| 72 |
+
return demo
|
| 73 |
+
|
| 74 |
+
def run_gradio():
|
| 75 |
+
demo = create_interface()
|
| 76 |
+
demo.launch()
|
| 77 |
+
|
| 78 |
+
if __name__ == "__main__":
|
| 79 |
+
run_gradio()
|