Spaces:
Sleeping
Sleeping
| import numpy as np | |
| import gradio as gr | |
| def add_and_subtract(input0, input1): | |
| input0 = np.array(input0) | |
| input1 = np.array(input1) | |
| out0 = input0 + input1 | |
| out1 = input0 - input1 | |
| return out0.tolist(), out1.tolist() | |
| iface = gr.Interface( | |
| fn=add_and_subtract, | |
| inputs=[ | |
| gr.Textbox(label="Input 0 (comma-separated numbers)"), | |
| gr.Textbox(label="Input 1 (comma-separated numbers)") | |
| ], | |
| outputs=[ | |
| gr.Textbox(label="Output 0 (Sum)"), | |
| gr.Textbox(label="Output 1 (Difference)") | |
| ], | |
| title="Add and Subtract Arrays" | |
| ) | |
| if __name__ == "__main__": | |
| iface.launch() | |