File size: 626 Bytes
814fe95
338c070
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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()