2020-08-22 05:20:05 +08:00
|
|
|
# Demo: (Dataframe) -> (Dataframe)
|
|
|
|
|
2020-08-06 01:42:52 +08:00
|
|
|
import gradio as gr
|
2020-10-29 02:39:28 +08:00
|
|
|
import numpy as np
|
2020-08-06 01:42:52 +08:00
|
|
|
|
|
|
|
def transpose(matrix):
|
|
|
|
return matrix.T
|
|
|
|
|
2020-08-28 23:56:03 +08:00
|
|
|
|
2020-11-11 22:15:53 +08:00
|
|
|
iface = gr.Interface(
|
2020-08-28 23:56:03 +08:00
|
|
|
transpose,
|
|
|
|
gr.inputs.Dataframe(type="numpy", datatype="number", row_count=5, col_count=3),
|
2020-10-29 02:39:28 +08:00
|
|
|
"numpy",
|
|
|
|
examples=[
|
|
|
|
[np.zeros((3,3)).tolist()],
|
|
|
|
[np.ones((2,2)).tolist()],
|
|
|
|
[np.random.randint(0, 10, (3,10)).tolist()],
|
|
|
|
[np.random.randint(0, 10, (10,3)).tolist()],
|
|
|
|
[np.random.randint(0, 10, (10,10)).tolist()],
|
|
|
|
]
|
2020-08-28 23:56:03 +08:00
|
|
|
)
|
|
|
|
|
2020-11-11 22:15:53 +08:00
|
|
|
iface.test_launch()
|
2020-10-23 22:28:30 +08:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2020-11-11 22:15:53 +08:00
|
|
|
iface.launch()
|