Spaces:
Sleeping
Sleeping
older gradio, torch
Browse files
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 💯
|
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: gray
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 4.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
|
|
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: gray
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.5.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
app.py
CHANGED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
|
|
|
|
|
|
| 3 |
|
| 4 |
def on_submit(img):
|
| 5 |
-
img = img['composite']
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
print(img[:3, :3])
|
| 9 |
-
return f"Sum: {np.sum(img)}"
|
| 10 |
|
| 11 |
iface = gr.Interface(
|
| 12 |
title = "LeNet",
|
| 13 |
fn = on_submit,
|
| 14 |
-
inputs=gr.Sketchpad(
|
| 15 |
outputs=gr.Label(),
|
| 16 |
)
|
| 17 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
+
import torch
|
| 4 |
+
import torchvision
|
| 5 |
|
| 6 |
def on_submit(img):
|
| 7 |
+
img = img['composite'].astype(np.float32)
|
| 8 |
+
img = torch.from_numpy(img)
|
| 9 |
+
return f"Sum: {img.shape}"
|
|
|
|
|
|
|
| 10 |
|
| 11 |
iface = gr.Interface(
|
| 12 |
title = "LeNet",
|
| 13 |
fn = on_submit,
|
| 14 |
+
inputs=gr.Sketchpad(image_mode='P'),
|
| 15 |
outputs=gr.Label(),
|
| 16 |
)
|
| 17 |
iface.launch()
|