File size: 777 Bytes
f188f8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
import numpy as np
import tensorflow as tf
from huggingface_hub import from_pretrained_keras

description = "Keras implementation for Video Vision Transformer to classify samples of medmnist"
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>"
title = "Video Vision Transformer on medmnist"

def infer(x):
    return model.predict(tf.expand_dims(x, axis=0))[0]

model = from_pretrained_keras("pablorodriper/vivit")

iface = gr.Interface(
    fn = infer,
    inputs = "video",
    outputs = "number",
    description = description,
    title = title,
    article = article
    )

iface.launch()