2021-05-24 23:31:44 +08:00
|
|
|
import numpy as np
|
|
|
|
|
2022-01-21 21:44:12 +08:00
|
|
|
import gradio as gr
|
|
|
|
|
|
|
|
|
2021-05-24 23:31:44 +08:00
|
|
|
def transpose(matrix):
|
|
|
|
return matrix.T
|
|
|
|
|
|
|
|
|
2022-03-29 06:13:39 +08:00
|
|
|
demo = gr.Interface(
|
2021-05-24 23:31:44 +08:00
|
|
|
transpose,
|
2022-03-29 06:13:39 +08:00
|
|
|
gr.Dataframe(type="numpy", datatype="number", row_count=5, col_count=3),
|
2021-05-24 23:31:44 +08:00
|
|
|
"numpy",
|
|
|
|
examples=[
|
2022-01-21 21:44:12 +08:00
|
|
|
[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()],
|
|
|
|
],
|
2022-08-17 00:07:20 +08:00
|
|
|
cache_examples=False
|
2021-05-24 23:31:44 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-03-29 06:13:39 +08:00
|
|
|
demo.launch()
|