Commit
•
f188f8f
1
Parent(s):
dd1efe9
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import numpy as np
|
3 |
+
import tensorflow as tf
|
4 |
+
from huggingface_hub import from_pretrained_keras
|
5 |
+
|
6 |
+
description = "Keras implementation for Video Vision Transformer to classify samples of medmnist"
|
7 |
+
article = "Author:<a href=\"https://huggingface.co/pablorodriper\"> Pablo Rodríguez</a>; Based on the keras example by <a href=\"https://keras.io/examples/vision/vivit/\">Aritra Roy Gosthipaty and Ayush Thakur</a>"
|
8 |
+
title = "Video Vision Transformer on medmnist"
|
9 |
+
|
10 |
+
def infer(x):
|
11 |
+
return model.predict(tf.expand_dims(x, axis=0))[0]
|
12 |
+
|
13 |
+
model = from_pretrained_keras("pablorodriper/vivit")
|
14 |
+
|
15 |
+
iface = gr.Interface(
|
16 |
+
fn = infer,
|
17 |
+
inputs = "video",
|
18 |
+
outputs = "number",
|
19 |
+
description = description,
|
20 |
+
title = title,
|
21 |
+
article = article
|
22 |
+
)
|
23 |
+
|
24 |
+
iface.launch()
|