Spaces:
Build error
Build error
File size: 1,530 Bytes
9b2dc59 ee594c9 9b2dc59 d50da4e 9b2dc59 4e2bdb8 9b2dc59 4e2bdb8 9b2dc59 4e2bdb8 ee594c9 4e2bdb8 ee594c9 4e2bdb8 d50da4e ee594c9 9b2dc59 2a3f66a 9b2dc59 ee594c9 cd58651 9b2dc59 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
import glob
import gradio as gr
import tensorflow as tf
from huggingface_hub import from_pretrained_keras
from predict import predict_label
##Create list of examples to be loaded
example_list = glob.glob("*.mp4")
example_list = list(map(lambda el:[el], example_list))
demo = gr.Blocks()
with demo:
gr.Markdown("# **<p align='center'>Video Vision Transformer on medmnist</p>**")
with gr.Tab("Upload & Predict"):
with gr.Box():
with gr.Row():
input_video = gr.Video(label="Input Video", show_label=True)
output_label = gr.Label(label="Model Output", show_label=True)
gr.Markdown("**Predict**")
with gr.Box():
with gr.Row():
submit_button = gr.Button("Submit")
gr.Markdown("Examples")
gr.Markdown("The model is trained to classify videos belonging to the following classes: liver, kidney-right, kidney-left, femur-right, femur-left, bladder, heart, lung-right, lung-left, spleen, pancreas")
with gr.Column():
gr.Examples(example_list, [input_video], [output_label], predict_label, cache_examples=False)
submit_button.click(predict_label, inputs=input_video, outputs=output_label)
gr.Markdown('\n Demo created by: <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>')
demo.launch()
|