Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,4 +31,16 @@ def predict(im):
|
|
| 31 |
out = model(x)
|
| 32 |
probabilities = torch.nn.functional.softmax(out[0], dim=0)
|
| 33 |
values, indices = torch.topk(probabilities, 5)
|
| 34 |
-
return {LABELS[i]: v.item() for i, v in zip(indices, values)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
out = model(x)
|
| 32 |
probabilities = torch.nn.functional.softmax(out[0], dim=0)
|
| 33 |
values, indices = torch.topk(probabilities, 5)
|
| 34 |
+
return {LABELS[i]: v.item() for i, v in zip(indices, values)}
|
| 35 |
+
|
| 36 |
+
interface = gr.Interface(
|
| 37 |
+
predict,
|
| 38 |
+
inputs="sketchpad",
|
| 39 |
+
outputs="label",
|
| 40 |
+
theme="huggingface",
|
| 41 |
+
title="Sketch Recognition",
|
| 42 |
+
description="Who wants to play Pictionary? Draw a common object like a shovel or a laptop, and the algorithm will guess in real time!",
|
| 43 |
+
article="<p style='text-align: center'>Sketch Recognition | Demo Model</p>",
|
| 44 |
+
live=True,
|
| 45 |
+
)
|
| 46 |
+
interface.launch(share=True)
|