Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
|
| 5 |
+
def transpose(matrix):
|
| 6 |
+
return matrix.T
|
| 7 |
+
|
| 8 |
+
demo = gr.Interface(
|
| 9 |
+
transpose,
|
| 10 |
+
gr.Dataframe(frozen_cols=2, type="numpy", datatype="number", row_count=5, col_count=3, show_fullscreen_button=True),
|
| 11 |
+
"numpy",
|
| 12 |
+
examples=[
|
| 13 |
+
[np.zeros((3, 3)).tolist()],
|
| 14 |
+
[np.ones((2, 2)).tolist()],
|
| 15 |
+
[np.random.randint(0, 10, (3, 10)).tolist()],
|
| 16 |
+
[np.random.randint(0, 10, (10, 3)).tolist()],
|
| 17 |
+
[np.random.randint(0, 10, (10, 10)).tolist()],
|
| 18 |
+
],
|
| 19 |
+
cache_examples=False
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
if __name__ == "__main__":
|
| 23 |
+
demo.launch()
|