Spaces:
Build error
Build error
import gradio as gr | |
import tensorflow as tf | |
from huggingface_hub import from_pretrained_keras | |
description = "Keras implementation for Video Vision Transformer trained with OrganMNIST3D (CT videos)" | |
article = "Classes: liver, kidney-right, kidney-left, femur-right, femur-left, bladder, heart, lung-right, lung-left, spleen, pancreas.\n\nAuthor:<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 OrganMNIST3D" | |
def infer(x): | |
return model.predict(tf.expand_dims(x, axis=0))[0] | |
model = from_pretrained_keras("keras-io/video-vision-transformer") | |
labels = ['liver', 'kidney-right', 'kidney-left', 'femur-right', 'femur-left', 'bladder', 'heart', 'lung-right', 'lung-left', 'spleen', 'pancreas'] | |
iface = gr.Interface( | |
fn = infer, | |
inputs = "video", | |
outputs = "number", | |
description = description, | |
title = title, | |
article = article | |
) | |
iface.launch() |